In my Application, I have 2 Classes:
- Group
- Model
and one base class Element
.
I use the single table strategy to persist these models. (strategy = InheritanceType.SINGLE_TABLE)
. Thus a column dtype
is created in my table.
I'm now trying to sort my pages based on this type:
find.where().disjunction()
.add(Expr.ilike("name", "%" + filter + "%"))
.orderBy("dtype asc, name asc," + sortBy + " " + order).findList()
But this throws an Exception, that dtype cannot be found.
How can I sort based on the type?
Thanks!
Sample base model can look like:
Then you can extend it like:
or
So you can choose all contents via:
Of course these objects will have only shared fields:
id
,dtype
,title
,created
andmodified
, for getting i.e. (News)newsSource
or (Post)publishDate
you need to get these objects with their own finders i.e. usingid
value from general Content query.