I have three classes Album{ Artist albumArtist; @Persistent(mappedBy = "parent") @Element(dependent = "true") List<Song> songs; }
Song{ Artist singer; Album parent; } Artist{ String name; } If I use the Artist instance I create for Album for Song(singer) - I get an error javax.jdo.JDOFatalUserException: Detected attempt to establish Album (1) as the parent of Album(1)/Song(2)/Artist(3) but the entity identified by Album(1)/Song(2)/Artist(3) is already a child of Album (1)/Song(2). A parent cannot be established or changed once an object has been persisted. CODE - THIS throws the above error Artist artist = new Artist("First", "LastN", "First Last"); Album album = new Album("Ahat and album", artist, 1978); Song song = new Song("Som song", album, artist); album.addSong(song); dao.makePersistantAndCommit(album); CODE: This works Artist artist = new Artist("First", "LastN", "First Last"); Artist artist2 = new Artist("Second", "LastN", "Second Last"); Album album = new Album("Ahat and album", artist, 1978); Song song = new Song("Som song", album, artist2); album.addSong(song); dao.makePersistantAndCommit(album); >From my app requirements standpoint - I can have an Artist who is the albumArtist and who is also the singer. And hence I have a need to use the Artist instance. Inputs -- 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.