Hi Marina
Thanks for answering. I do not fully understand what you mean.
The annotations in the entity are commented out because I use XML instead of annotations. So the entity looks exactly like the one in the link.
If you see the link to the XML-file, you can see how I've defined the relationship between the entities.
The person field is marked as a relationship in the orm.xml file:
<snip>
<!-- Join with person entity -->
<many-to-one name="person"
target-entity="com.bluebricks.net.entity.Person"
fetch="EAGER">
<join-column name="person"/>
</many-to-one>
</snip>
I've tried with the person column as an ordinary integer column and also when it is defined as a foreign key. No difference.
In the Access entity, the person field is of type Person, of course.
The first reference to one of my classes in the stack trace is to the bean class, line 98, which is this line:
return entityClass.cast( query.getSingleResult( ) );
This might mean that the object returned by the getSingleResult() method is NOT of the class represented by the entityClass variable (which is Access.class).
I don't know what other class it could be, as the jpql query points to the Access class.
(The reason for the cast is that I use generics so that the same bean can be used by any entity)
Marius
[Message sent by forum member 'mariusw' (mariusw)]
http://forums.java.net/jive/thread.jspa?messageID=231963