Folks,
How could I refer to the code of UOMVO in HQL for my example at the bottom? (e.g. vo.quantityAllocations.quantity.UOMVO.code)
Code:
<!--
HQL
-->
select vo.code from BinSVO vo where 'Each' in elements(vo.quantityAllocations.quantity.UOMVO.code)
<!--
Exception
-->
net.sf.hibernate.QueryException: expecting 'elements' or 'indices' after: quantity [select vo.code from com.cendec.ikermit.materials.vo.BinSVO vo where 'Each' in elements(vo.quantityAllocations.quantity.UOMVO.code)
<!--
HQL
-->
select vo.code from BinSVO vo where 'Each' in elements(vo.quantityAllocations)
<!--
Generated SQL
-->
SELECT binsvo0_.code AS x0_0_
FROM bin binsvo0_
WHERE ('Each' IN (
SELECT quantityal1_.accountobjid, quantityal1_.afeobjid,
quantityal1_.companyobjid, quantityal1_.facilityobjid,
quantityal1_.featureobjid, quantityal1_.costamount,
quantityal1_.costcurrency_gnluobjid,
quantityal1_.quantityamount,
quantityal1_.quantityuom_gnluobjid,
quantityal1_.quantityjoint
FROM bin_quantityallocation quantityal1_
WHERE binsvo0_.objid = quantityal1_.binobjid)
)
<!--
hbm file of BinSVO
-->
<!-- Quantity Allocation for the Bin -->
<bag name="quantityAllocations" cascade="all" table="bin_quantityallocation" lazy="false">
<key column="BINOBJID"/>
<composite-element class="QuantityAllocation">
<nested-composite-element class="AccountString" name="accountString">
<many-to-one name="accountCode" column="accountobjid" class="AccountVO"/>
<many-to-one name="afeCode" column="afeobjid" class="AFEVO"/>
<many-to-one name="companyCode" column="companyobjid" class="CompanyVO"/>
<many-to-one name="facilityCode" column="facilityobjid" class="FacilityVO"/>
<many-to-one name="featureCode" column="featureobjid" class="FeatureVO"/>
</nested-composite-element>
<nested-composite-element class="Cost" name="cost">
<property name="amount" column="costamount" type="double"/>
<many-to-one name="currency" column="costcurrency_gnluobjid" class="CurrencyVO"/>
</nested-composite-element>
<nested-composite-element class="Quantity" name="quantity">
<property name="amount" column="quantityamount" type="double"/>
<many-to-one name="UOMVO" column="quantityuom_gnluobjid" class="UOMVO"/>
<property name="joint" column="quantityjoint" type="long"/>
</nested-composite-element>
</composite-element>
</bag>
Thanks in advance!
Martin
Code: