I am using Hibernate 3, and attempting to use the <join> tag to join 2 legacy tables together. Unfortunately, the IDs for the tables are composites. Not a problem, Table 1 has a <composite-id> to do the query. This works fine.
Table 2 unfortunately names the columns differently from Table 1.
Here is an example of how the ID fields map.
TABLE.FIELD
Table1.fieldX
Table2.fieldX
TABLE.FIELD
Table1.fieldY
Table2.yField
As you can see, Table 2 does not have the same name for fieldY as Table 1.
Because the <join table="table2"> tag requires a <key> tag, containing <column name="..."> tags, I have included both fieldX and fieldY as columns.
Is it possible to join these tables?
I have already looked at
http://blog.exadel.com/?p=16, which explains how to do this if Table 1's single key field matches the single key field in Table 2.
Thanks, Brad