Sorry, didn't see that polymorphic relationships were not supported:
http://code.google.com/appengine/docs/java/datastore/jdo/relationships.html#Polymorphic_Relationships

2011/7/19 Sébastien Tromp <sebastien.tr...@gmail.com>

> Hello,
>
> I have the following classes:
>
> ------------------------------------
> @PersistenceCapable(detachable = "true", identityType =
> IdentityType.APPLICATION)
> @Inheritance(customStrategy = "complete-table")
> public class Move implements Cloneable, Serializable {
>
>     @PrimaryKey
>     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>     @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value =
> "true")
>     private String id;
>
>     @Persistent(defaultFetchGroup = "true")
>     @Embedded
>     private DelayedEffect delayedEffect;
> }
>
> -----------------
>
> @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable =
> "true")
> @Inheritance(customStrategy = "complete-table")
> public abstract class DelayedEffect implements Serializable {
>
>     @PrimaryKey
>     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>     @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value =
> "true")
>     protected String id;
> }
>
> -----------------
>
> @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable =
> "true")
> @Inheritance(customStrategy = "complete-table")
> public class SlowOpponentDelayedEffect extends DelayedEffect {
>     @Persistent
>     private int slowStrength;
> }
>
> ------------------------------------
>
> When persisting the Move object (code snippet below), I get the following
> exception:
>
> java.lang.RuntimeException: Unable to locate
> com.fiveorbs.shared.models.SlowOpponentDelayedEffect.slowStrength in
> embedded meta-data map.  This is most likely an App Engine bug.
> at
> org.datanucleus.store.appengine.DatastoreFieldManager.buildMappingConsumer(DatastoreFieldManager.java:1211)
>  at
> org.datanucleus.store.appengine.DatastoreFieldManager.storeEmbeddedField(DatastoreFieldManager.java:984)
> at
> org.datanucleus.store.appengine.DatastoreFieldManager.storeObjectField(DatastoreFieldManager.java:810)
>
> ------------------------------------
> final Move move = new Move();
> final SlowOpponentDelayedEffect effect = new SlowOpponentDelayedEffect();
> effect.setSlowStrength(5);
> move.setDelayedEffect(effect);
>
> final PersistenceManager pm = this.newPersistenceManager();
> final Move persistent = pm.makePersistent(move); // Exception is thrown
> there
>
> ------------------------------------
> Please note that I have no problem when trying to persist embedded fields
> that do not involve inheritance.
> I googled around, but could not find anyone with a similar issue (except
> here <http://hoangle.info/2010/07/06/jpa-in-google-app-engine-embedded/>,
> but it involves JPA).
>
> Does anyone has any clue as to what the problem could be?
>
> Thanks in advance for your help,
> --
> seb
>
>


-- 
Seb

-- 
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-java@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.

Reply via email to