Hi,
We recently migrated to Hibernate 4.2.21 release from open jpa as JPA provider. We observed while migration that if the composite keys of two different tables are same, we cannot use different generated PK classes for different tables. For example,
TableA entity has composite key a,b, for which TableAPK gets generated.
TableB entity has composite key a,b, for which TableBPK gets generated.
If we use entityManager.find, we get a TypeMismatch exception stating that Provided Id was TableBPK while it expected TableAPK. The issue can be resolved if we delete TableBPK and have TableB refer to TableAPK as embedded id.
We use eclipse / RAD to generate the entities from tables and making these manual changes does not seem right when this was working in open JPA. Not sure if there is a bug in hibernate to handle such a scenario or it is done on purpose to promote using only single type of key. I understand the rationale behind it, but still wanted to understand if there is an alternate way.
If you need more details on what I am referring to , refer to an old stack overflow post below.
http://stackoverflow.com/questions/1616 ... ue-on-read