On Nov 23, 8:02 pm, "Serega.Sheypak" <[EMAIL PROTECTED]> wrote:
> For example I have an entity:
> AbstractRecord, it has fields:
> String name, Date publishDate, Author recordAuthor, List tagList.
>
> And I have several subclasses:
> BlogRecord, CommentRecord, AdvertiseRecord.
>
> They extend AbstractRecord, they have their own specific fields.
>
> Can I make a query: "Select * from AbstractRecord where tagList =
> 'google' "
> And get all AbstractRecord entites, also its subclasses which have tag
> 'google' in List field.

Sorry, you can't do it.

It 's because Datastore uses different entity kinds for your inherited
model classes.
Translation is simple: Entity Kind = Name of your Model class
Datastore is not an object oriented database and from its point of
view, these records are for different entity kinds.

On the other hand, datastore doesn't require a central schema for your
entities of same type.
Instead of trying to use inheritance with db.Model, switch to Expando,
define your base properties again
and add a "record_type" property. In expando, all properties are
dynamic so add whatever needed in your control flow.
Record Type will help you to discriminate your records in the query.

If you want model level validations, you have to roll them manually.

In case you desire to use inheritance for whatever kind of plausible
reason, you might try create your own inheritable db.Expando and fix
the entity naming behavior with some monkey patching (http://
en.wikipedia.org/wiki/Monkey_patch)

Good luck!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to