-
Notifications
You must be signed in to change notification settings - Fork 161
Description
Assuming the following structures
@Entity
public class Foo{
@Id Long id;
@Index private int number;
}
@Subclass(index=true)
public class Bar extends Foo{
@Index int numberTwo;
@Index String someval;
}
Attempting to project has some weird behavior.
ofy.load().type(Foo.class).project("numberTwo").filter("someval", "foobar").first().now();
Running the above query will return me an object of type "Foo" with all of the foo properties filled in, and none of the bar properties, especially the property I projected.
ofy.load().type(Bar.class).project("numberTwo").filter("someval", "foobar").first().now();
Will throw a class cast exception trying to convert Foo to Bar.
It seems to me like Objectify will only load properties for the top level Entity and none of the sub-classes when projecting and will completely ignore the type parameter and any properties of classes in the ^i or ^d properties.
I searched all over and can't seem to find a reason for this in Datastore or the ofy documentation so I'm going to assume it might not be desired behavior.
Any ideas?