1st, you're posting a non-annotations-related question to wrong forum :) But you're mapping is very close to what you need. One thing you need to keep in mind that Hibernate does not need to emulate exactly what the database does. Just because the database defines a composite PK, doesn't mean your Object model needs one as well.
Since you can't have 2 IDs in a mapping file, as that is invalid, you obviously need to make sure those values are stored when you create or update the entity. You can however treat VERSION column a non-null property of your entity, even though the database sees it as part of the PK on the ASSEMBLY_ITERATION table. The mapping for ASSEMBLY_ID is already there due to the <key> element on the <join>. If you do that, it should work.
Ryan-
_________________ Ryan J. McDonough
http://damnhandy.com
Please remember to rate!
|