I'd recommend reading this blog post - it contains everything you need to know to persist a one-to-many with JPA:
http://gae-java-persistence.blogspot.com/2009/10/creating-bidrectional-owned-one-to-many.html Max On Wed, Dec 16, 2009 at 2:21 PM, Richard <richard.fa...@gmail.com> wrote: > Hi guys, > > I try to persist a one to many relationship but I get the following > error (It's my first app): > > Caused by: java.lang.IllegalStateException: Field > "fr.beasymptotic.bookmark.client.model.BookmarkUser.bookmarks" > contains a persistable object that isnt persistent, but the field > doesnt allow cascade-persist! > > > What's wrong here : > > @Entity > public class Bookmark implements Serializable { > /** > * > */ > private static final long serialVersionUID = > -5148690849535943792L; > > @Id > @GeneratedValue(strategy = GenerationType.IDENTITY) > @Extension(vendorName="datanucleus", key="gae.encoded-pk", > value="true") > private String id; > > @Basic > private String link; > @Basic > private String shortName; > > ... > > } > > > > @Entity > public class BookmarkUser implements Serializable { > /** > * > */ > private static final long serialVersionUID = > -4970721952298475845L; > > @Id > @GeneratedValue(strategy = GenerationType.IDENTITY) > private Long id; > > @Basic > private String userUIDFromGoogle; > > @Basic > private List<Bookmark> bookmarks; > ... > > } > > Thanks, > Richard > > -- > > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > google-appengine-j...@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.