MountainClimb / datanucleus-appengine

Automatically exported from code.google.com/p/datanucleus-appengine
0 stars 0 forks source link

ClassCastException during makePersistent() with @Embedded child #247

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have the following JDO entity relationship:

Project --1:n List--> Group --1:1 Embedded--> UrlSet --1:n List--> Url

UrlSet entity is defined as:

@PersistenceCapable(identityType=IdentityType.APPLICATION, detachable="true")
public class UrlSet  {

  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  private com.google.appengine.api.datastore.Key key;
...
}
1. load and detach the Project entity
2. add Group entity as a child to the Project entity
3. call makePersistent() for the Project entity

What is the expected output? What do you see instead?
Expected: the entity and its children are persisted.
Instead:

java.lang.ClassCastException: com.google.appengine.api.datastore.Key cannot be 
cast to java.util.Collection
    at org.datanucleus.store.mapped.mapping.CollectionMapping.postInsert(CollectionMapping.java:91)
    at org.datanucleus.store.appengine.DatastoreRelationFieldManager.runPostInsertMappingCallbacks(DatastoreRelationFieldManager.java:218)
    at org.datanucleus.store.appengine.DatastoreRelationFieldManager.access$200(DatastoreRelationFieldManager.java:49)
    at org.datanucleus.store.appengine.DatastoreRelationFieldManager$1.apply(DatastoreRelationFieldManager.java:117)
    at org.datanucleus.store.appengine.DatastoreRelationFieldManager.storeRelations(DatastoreRelationFieldManager.java:82)
    at org.datanucleus.store.appengine.DatastoreFieldManager.storeRelations(DatastoreFieldManager.java:959)
    at org.datanucleus.store.appengine.DatastorePersistenceHandler.storeRelations(DatastorePersistenceHandler.java:585)
    at org.datanucleus.store.appengine.DatastorePersistenceHandler.insertPostProcess(DatastorePersistenceHandler.java:320)
    at org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObjects(DatastorePersistenceHandler.java:272)
    at org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObject(DatastorePersistenceHandler.java:256)
    at org.datanucleus.store.appengine.DatastoreFKListStoreSpecialization.updateElementFk(DatastoreFKListStoreSpecialization.java:116)
    at org.datanucleus.store.mapped.scostore.FKListStore.updateElementFk(FKListStore.java:254)
    at org.datanucleus.store.mapped.scostore.FKListStore.internalAdd(FKListStore.java:397)
    at org.datanucleus.store.appengine.DatastoreFKListStore.internalAdd(DatastoreFKListStore.java:146)
    at org.datanucleus.store.mapped.scostore.AbstractListStore.add(AbstractListStore.java:105)
    at org.datanucleus.sco.backed.List.add(List.java:649)
    at org.datanucleus.sco.SCOUtils.updateListWithListElements(SCOUtils.java:842)
    at org.datanucleus.sco.simple.List.attachCopy(List.java:232)
    at org.datanucleus.store.fieldmanager.AttachFieldManager.storeObjectField(AttachFieldManager.java:205)
    at org.datanucleus.state.AbstractStateManager.providedObjectField(AbstractStateManager.java:1037)
    at model.Project.jdoProvideField(Project.java)
    at model.Project.jdoProvideFields(Project.java)
    at org.datanucleus.state.JDOStateManagerImpl.provideFields(JDOStateManagerImpl.java:2715)
    at org.datanucleus.state.JDOStateManagerImpl.internalAttachCopy(JDOStateManagerImpl.java:4055)
    at org.datanucleus.state.JDOStateManagerImpl.attachCopy(JDOStateManagerImpl.java:3987)
    at org.datanucleus.ObjectManagerImpl.attachObjectCopy(ObjectManagerImpl.java:1778)
    at org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java:1260)
    at org.datanucleus.ObjectManagerImpl.persistObject(ObjectManagerImpl.java:1175)
    at org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:669)
    at org.datanucleus.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:694)

What version of the product are you using? On what operating system?

datanucleus-core: 1.1.5
datanucleus-appengine: 1.0.9
Windows XP, GAE-SDK 1.5.2

Original issue reported on code.google.com by testmail...@gmail.com on 26 Aug 2011 at 5:08

GoogleCodeExporter commented 8 years ago
Since you don't provide a testcase you are advised to try SVN trunk of this 
plugin.

Original comment by googleco...@yahoo.co.uk on 26 Aug 2011 at 6:02

GoogleCodeExporter commented 8 years ago

Original comment by googleco...@yahoo.co.uk on 21 Sep 2011 at 3:52

GoogleCodeExporter commented 8 years ago
Not enough information to reproduce was provided. Feel free to reopen if you 
can provide additional info.

Original comment by googleco...@yahoo.co.uk on 21 Jan 2012 at 4:39

GoogleCodeExporter commented 8 years ago
Not enough information to reproduce was provided. Feel free to reopen if you 
can provide additional info.

Original comment by googleco...@yahoo.co.uk on 21 Jan 2012 at 4:39