Currently, I have some abstract model classes which have common behaviours for other concrete models. For instance, an abstract SearchableModel.class might be inherited by other concrete models.
When using Objectify, I would like to annotate the SearchableModel class, because it requires the persistance of it's own fields. However, I am not interested in doing any sort of polymorphic queries and I dont want any entities of kind "SearchableModel" in the datastore, only the kinds of concrete classes inheriting from SearchableModel. How should I proceed with the @Entity/@EntitySubClass annotations?
If I annotate both the abstract and concrete classes with @Entity, and persist/load the instance of concrete classes, will it work as expected?
I know I could test it myself, however, I didn't setup objectify yet. I am still trying to figure it out how it could be used with my current model.
Any other suggestions on how to organize this sort of dependence is appreciated as well.
Thank you.
This will give you want you want. You can put common fields (with Objectify annotations, including @Id/@Parent) and behaviors in the base class. There will not be any datastore polymorphism and each @Entity will have its own datastore kind.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With