Casting to specific class in HQL
- by bungrudi
My situation is like this.. (note: for those who work with JBPM might already familiar with following data structures and HB mapping)
Class LongInstance extends from VariableInstance, with the mapping for field "value" overridden in LongInstance.
The mapping for VariableInstance is here and for LongInstance here.
VariableInstance is polymorphically mapped to a collection in TokenVariableMap, the mapping is here.
The question: how can I query the polymorphic collection using specific/overridden property of the member class?
I'm looking for something like this
"... from TokenVariableMaps tvm
left join fetch tvm.variableInstances tvi
where cast(tvi as LongInstance).value in(:vars)"