Hello
I have a very uncommon problem. I have a number of tables with single-column primary key and a dictionary table where descriptions in several languages a given for the values in those tables. To select description for table 'A' I should make such a query:
select d.description from A, description d where d.code = A.id and d.tablename = 'A'
So, column tablename in the description is a selector for various tables
How can I use CMR for this kind of relationship. I tried following approaches:
1. Add non-persistent field tablename to table A, and map description to A via code and tablename. Doesn't work
2. Add cmp field tablename to table A. Reports "DeploymentException: CMP field for key not found: field name=tablename". I suppose this is because relations can be used when mapped to primary key.
3. Make that field part of the A's primary key. Reports "DeploymentException: Mappings were not provided for all fields: unmaped fields=[tablename]". I suppose this is because JBoss checks if a field is really part of primary key in the db.
Am I right in my suggestions and what can I do in this situations? I have lots of such relations in my scheme and it would be vary dissapointing to reject CMR here.
Please help
Thank you in advance
Konstantin Dmitriev