brightspot-cms icon indicating copy to clipboard operation
brightspot-cms copied to clipboard

Query only parent class instances

Open Typografikon opened this issue 7 years ago • 0 comments

Hi,

I found I get instances of Parent class and also instances of all subclasses when I call:

Query.from(Parent.class).selectAll();

What is best approach to query only Parent class instances? I found

Query.from(Parent.class).where("_type = ?", ObjectType.getInstance(Parent.class).getId()).selectAll();

But I am not sure if it is best way to do it.

Thanks for response, O.

Typografikon avatar May 06 '17 16:05 Typografikon