Casting to specific class in HQL

Posted by bungrudi on Stack Overflow See other posts from Stack Overflow or by bungrudi
Published on 2011-01-11T04:48:55Z Indexed on 2011/01/11 4:53 UTC
Read the original article Hit count: 215

Filed under:
|
|

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)"

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate