I have tried sample showed on the link you provided, but as I thought, it didn't worked.
It throws a PropertyAccessException:
And the last Exception:
Caused by: java.lang.IllegalArgumentException: Can not set long field com.test.PhonePK.owner to com.test.Employee
It seems that he wants to map the Employee to the owner, which is good, but don't map Employee.id to PhonePK.owner but the Employee instance to PhonePK.owner.
What can I do ?
I got exactly the same PropertyAccessException problem using JPA 1 with hibernate 3.2.1 ga implementation (in addition to http://opensource.atlassian.com/projects/hibernate/browse/HHH-4256 for the record).
The sample looks correct according to JPA (2) specification. I'm stucked. I'll check JPA 1 specification.
Did you find any thing on your side ?
Joined: Mar 02, 2010
I solved the problem.
It comes from the JPA implementation, which isn't JPA 2. Check your configuration.
If you are using Jboss AS 5.1, JPA 2 is not implemented in it.
It can be added to a project if you put directly the library in it and reference it in the classpath.
I didn't wanted to bother with that, so I switched to Jboss AS 6.0 M2 as I have no production plans atm, but I'll probably have to put the JPA2 implementation onto my project later anyway.