Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.0.5
Mapping documents:
Code:
<class
name="com.pnetx.ecomm.domain.Product"
table="Product"
>
...
<map
name="names"
table="ProductName"
lazy="true"
cascade="all"
order-by="language"
fetch="join"
>
<key column="product"/>
<map-key
column="language"
type="string"
length="10"
/>
<element
column="value"
type="string"
length="255"
not-null="true"
/>
</map>
...
</class>
Name and version of the database you are using: PostgreSQL 8.0.1The Product class has a
Code:
Map getNames()
collection that is indexed using a language identifier.
Now the question is: how do I obtain a list of all Products sorted by product name in a specific language?
In SQL I'd do something like:
Code:
select p.* from product p, productname pn where pn.language = ? and pn.product = p.id order by pn.value
I'd like to know if it's possible to do it in HQL and how? I'd rather not sort in memory if the database can do it for me.