>
> - Datanucleus now supports polymorphic relationships.
>   http://code.google.com/p/datanucleus-appengine/issues/detail?id=153
>

Can anyone explain to me how to use this? I've got a simple example that 
doesn't work (see below). Sofa extends Furniture, but when I try to persist 
a collection of furniture in a House, I get the following:

"java.lang.UnsupportedOperationException: Received a child of type 
modeltest.server.Sofa for a field of type modeltest.server.Furniture. 
 Unfortunately polymorphism in relationships is not yet supported."

I'm using the 1.5.1 SDK.

// imports
@PersistenceCapable
public class House {

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = 
"true")
String id;

@Persistent ArrayList<Furniture> furniture;
 House() {
furniture = new ArrayList<Furniture>();
furniture.add(new Sofa());
}

}

// imports...
@PersistenceCapable
@Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
public abstract class Furniture {

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = 
"true")
String id;

}

// imports
@PersistenceCapable
public class Sofa extends Furniture {

}

Best,

~Owen


> -- 
> Johan Euphrosine (proppy)
> Developer Programs Engineer
> Google Developer Relations
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/XZVgvet2QhgJ.
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