users@glassfish.java.net

Re: JPA - One-To-Many relationship query problem

From: <glassfish_at_javadesktop.org>
Date: Fri, 01 Feb 2008 08:10:48 PST

The Cardinality problem is that you are attempting to use the same Entity attribute as both the ID and the relationship to ListMenuType. You can not do that. You must have a separate attribute for the ID that is a simple type.

You should not need to change the mapping to EAGER. You will simply need to access the relationship's [b]collection[/b] to have the values loaded. By default the OneToMany is lazily loaded.

Nothing special needs to be done. Is the ListMenuType that you are calling Persist on new or managed? Have you verified that the collection contains the new items? Are you adding the new items to the existing collection or setting an entire collection?
--Gordon
[Message sent by forum member 'gyorke' (gyorke)]

http://forums.java.net/jive/thread.jspa?messageID=257018