I think i may have found the answer searching the group, in the meantime :)
".....this implementation prevents us from supporting a one to one and a one to many of the same type on the same object" http://groups.google.com/group/google-appengine-java/browse_thread/thread/c0f673eaf229ac37/ad4fabd406baf102?lnk=raot&fwc=1 On Thu, Aug 27, 2009 at 3:04 PM, Cornel <[email protected]> wrote: > Hello! > > I get this exception: > > java.lang.ClassCastException: oid is not instanceof > javax.jdo.identity.StringIdentity > at .....DbContact.jdoCopyKeyFieldsFromObjectId(DbContact.java) > ...... > > when i try to do the following: > > customer = new DbCustomer(); > contact = new DbContact(); > ..... set properties of contact.... > customer.setProfile(contact); > .... set other properties of customer > > Transaction tx = pm.currentTransaction(); > try { > tx.begin(); > pm.makePersistent(customer); > tx.commit(); > } > finally { > if (tx.isActive()) { > tx.rollback(); > } > > My classes look like this: > > public class DbCustomer { > > @PrimaryKey > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > @Extension(vendorName="datanucleus", key="gae.encoded-pk", > value="true") > private String encodedKey; > > @Persistent > private DbContact profile; > > @Persistent(mappedBy = "customer") > private List<DbContact> privateContacts; > > @Persistent(mappedBy = "customer") > private List<DbUserProfile> users; > ..... > } > > public class DbContact { > > @PrimaryKey > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > @Extension(vendorName="datanucleus", key="gae.encoded-pk", > value="true") > private String encodedKey; > > @Persistent > private DbCustomer customer; > ..... > } > > Any ideas what this exception means and why it occurs? > I think it might have something to do with the fact that i'm using > String encoded key instead of Key, > but i'm not sure... and should this be a problem? -- Corneliu Paul Lupulet --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~----------~----~----~----~------~----~------~--~---
