Here's the stacktrace I get when calling remove on a list containing
child elements of a one to many owned relationship.
java.lang.ClassCastException: java.lang.Long cannot be cast to
java.lang.String
at
org.datanucleus.store.appengine.DatastoreFKListStoreSpecialization.removeAt
(DatastoreFKListStoreSpecialization.java:155)
at org.datanucleus.store.mapped.scostore.FKListStore.removeAt
(FKListStore.java:525)
at org.datanucleus.store.mapped.scostore.AbstractListStore.remove
(AbstractListStore.java:318)
at org.datanucleus.sco.backed.List.remove(List.java:907)
at usabletek.plyus.server.TestEntity.demonstrateProblem
(TestEntity.java:31)
I'm trying to figure out if I'm not allowed to use Longs as primary
keys, or if this is a bug, or if I'm doing something else wrong with
the relationship.
Here's as minimal an example as I can come up with:
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class TestEntity {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
@Persistent(mappedBy = "parent")
private List<TestChildEntity> childEntities;
public List<TestChildEntity> getChildEntities() {
return childEntities;
}
public static void demonstrateProblem(){
PersistenceManager pm = PMF.get().getPersistenceManager();
TestEntity te = new TestEntity();
pm.makePersistent(te);
te.getChildEntities().add(new TestChildEntity("a"));
te.getChildEntities().remove(0);
pm.close();
}
}
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class TestChildEntity {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value
= "true")
private String encodedKey;
@Persistent
@Extension(vendorName = "datanucleus", key = "gae.pk-name", value =
"true")
private String keyName;
@Persistent
private TestEntity parent;
public TestChildEntity(String k){
this.keyName = k;
}
}
--
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=.