Hello all,
Is it possible to run a polymorphic query using ordering and where predicates on fields which belong to a subclass of the base class?
More specifically, my application includes a grid/table with search and order functionality. The rows of the grid represent hibernate beans which have the same super class. A column in the table could display values which belong to a field of only one subclass. The rest rows which represent beans of the same class hierarchy should display a default value.
My problem is that I cannot find a way to create hql or criteria queries which do polymorphic queries and also order and have predicates of fields belonging to one or some subclasses of the class hierarchy.
I have a feeling that hibernate does not support this feature. So my alternative solution is to avoid polymorphic queries and create a hibernate bean which represent a grid. Each field will map to a grid column.
However this approach requires a database view which maps to the new grid hibernate bean. And consequently static SQL (which I try to avoid) must be used for this purpose.
Do you have any idea on how to tackle the problem using hibernate?
Regards,
Kostas
|