I have an application structured almost the same as the example of customer>order>lineItem>product
but when i am trying to query for the transactions that have a certain product involved, like in SQL:
select transactionInfo.* from transactionInfo join transactionItemInfo join productInfo where productInfo.productId = 4
i am having all kinds of difficulties in HQL.
finally, i tried just having:
"select transactionInfo from TransactionInfo as transactionInfo "+
"join transactionInfo.transItems as item join item.productInfo as product "
the above gave me an error of:
net.sf.hibernate.QueryException: collection of values in from clause
what is proper way to translate that SQL statement to HQL...??
FYI:
in the TransactionInfo.hbm.xml
<list name="transItems" table="transactionItemInfo" lazy="false">
<key column="transactionId"/>
<index column="transactionItemId"/>
<composite-element class="volante.mlm.data.TransactionItemInfo">
<property name="productQuantity"/>
<property name="version"/>
<many-to-one name="productInfo" column="productId"/>
</composite-element>
</list>
thanks a bunch.
|