java - Entity hierarchies in Objectify 4.0 -


is there way how define entity hierarchy enables query particular subclass? consider situation below. let's have abstract base class defines common properties , concrete subclasses , b.

class abstract base { ... }  class extends base { ... }  class b extends base { ... } 

i run example queries follows.

  • to retrieve entities of type , b

     base base = this.objectify.load().type(base.class).list(); 
  • to retrieve entities of type a

     base base = this.objectify.load().type(a.class).list(); 
  • to retrieve entities of type b

     base base = this.objectify.load().type(b.class).list(); 

furthermore, store such entities single type (base entity) in gae datastore.

we tried use polymorphic hierarchy of related entity classes described here:

https://code.google.com/p/objectify-appengine/wiki/entities#polymorphism

but seems not capable of handling situation there multiple entity subclasses common parent.

i don't think base can abstract, should work:

@entity class base { ... }  @entitysubclass(index=true) class extends base { ... }  @entitysubclass(index=true) class b extends base { ... } 

if want able query polymorphic type, must index types want query by.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -