Hi guys,
i have a problem to use the hql-statement below. My mapping looks as follow:
How can make a hql-statement to use an object within a composite-element structure? I know that you can only use mapped classes.
I did not find any other proper solution!
Do you have any ideas? Any help would be very appreciated. Thanks
Code:
<hibernate-mapping default-access="field" default-lazy="false">
<class name=Car table="CAR">
<property name="description" type="string">
<column name="description" length="200" />
</property>
<list name="equipmentChoices" table="Car_Equipment" inverse="false">
<key column="CAR_ID" />
<list-index column="Car_Equipment_ID" />
<composite-element class="EquipmentChoice">
<property name="released" column="Released" type="boolean"/>
<many-to-one name="equipment" class="Equipment" column="Equipment_Id" />
</composite-element>
</list>
</class>
<hibernate-mapping>
hql:
Code:
select c from Car c
where exists (select count(*) from c.equipmentChoices ec where ec.equipment.id = ?)