Utiliser un élement mapper en tant que <any> dans une requête HQL.
Hibernate version: 3.1
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
Name and version of the database you are using: Oracle 10g
Des lignes sont retournées lorsque pour
entityClass est passée une valeur de type meta et non la classe. Exemple : si
A est passée et non la classe
Area
Est-il possible d'utiliser le nom de la classe comme paramètre qui est connu et non la meta-value de l'élément <any> qui n'est défini que dans le fichier de mapping ?
Hibernate documentation reference: 3.1 - page 152
Cela semble possible d'après ce paragraphe...