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?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to