-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Multilingual sorting
PostPosted: Wed Nov 16, 2005 10:46 am 
Newbie

Joined: Thu Dec 16, 2004 7:11 am
Posts: 7
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.1

The 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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.