Use an element mapped as <any> in HQL
Hibernate version: 3.1
Name and version of the database you are using: Oracle 10g
Mapping documents:
<class name="AuditRequest" ...>
...
<any name="targetEntity" id-type="long" meta-type="string" >
<meta-value value="A" class="Area" </>
<meta-value value="R" class="Role" </>
<column name="ENTITY_TYPE" />
<column name="ENTITY_ID" />
</any>
</class>
HQL request:
Code:
from AuditRequest req
where req.targetEntity.class = :entityClass
and req.targetEntity.id = :entityId
I would like to pass
'Area' or
'Role' value for the
entityClass named parameter.
But, rows are returned when the meta-value is set for
entityClass . (
'A' or
'R' in the example.
How could I use the class name in the HQL ?
Note : I use here the syntax as defined by
Hibernate documentation reference: 3.1 - page 146.
Thanks for help.