hi all ,
I have 2 tables, one is Package another is Product .
Package not nescessary have product , so generally when we using
sql , we will left join product with the package in order to view
the record of package even though there are no product link with it.
Question is , in the HQL , can we use left join for the same purpose?
if can , when i code like this
-------------------------------------------------------------------------------------
[CODE]
queryString.append("select package.name, package.price from Product as product LEFT JOIN Package as package on package.Id = product.PackageId");
Lsit 1 = session.createQuery(queryString.toString().list());
[CODE]
-------------------------------------------------------------------------------------
my mapping file is like this
-------------------------------------------------------------------------------------
[for the association in Package.hbm]
<set inverse="true" name="ProductSet">
<key column="bi_package_id" />
<one-to-many class="Product" />
</set>
[for the association in Product.hbm]
<many-to-one
class="Package"
name="PackageId"
not-null="true"
>
<column name="bi_package_id" />
</many-to-one>
-------------------------------------------------------------------------------------
but it throw me the exception:
[CODE] net.sf.hibernate.QueryException: outer or full join must be followed by path expression
Can someone help me with this. Thanks.
|