-->
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.  [ 5 posts ] 
Author Message
 Post subject: order-by
PostPosted: Fri Mar 03, 2006 6:56 am 
Newbie

Joined: Fri Mar 03, 2006 6:49 am
Posts: 3
Hi, all! (I am a newbie for Hibernate)

look in hibernate reference
order-by (optional, JDK1.4 only) specify a table column (or columns) that define the iteration order of
the Map, Set or bag, together with an optional asc or desc


at test/org.hibernate.test.collection

in UserPermissions.hbm.xml:
Code:
      <map name="sessionData"

            order-by="lower(`attributeName`) asc"

            lazy="extra">
         <key column="userName"/>
         <map-key column="`attributeName`"
               type="string"/>
         <element column="`attributeValue`"
               type="serializable"
               not-null="true"/>
      </map>


There we have ordering by lower(column_name).

What is correct?
Does somebody know workaround in case my DB supports only
Code:
order by column_name asc|desc
?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 03, 2006 11:28 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
not entirely sure what you're asking..

are you asking what if the underlying DB doesn't support having the 'lower' command after the words 'order by'?

I would say the easiest way is to simply change the mapping files on a case by case basis. The beauty of having this stuff in xml files is that it doesn't require recompiling the project to implement a change... unless you're using WAR or JAR files :)

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 03, 2006 11:38 am 
Newbie

Joined: Fri Mar 03, 2006 6:49 am
Posts: 3
kochcp wrote:
not entirely sure what you're asking..

are you asking what if the underlying DB doesn't support having the 'lower' command after the words 'order by'?


Thank you.

I will try to explain more clearly.

Really I find this example in test directory of hibernate (downloaded from CVS), so it's strange for me tests doesnt satisfy to reference.

I test my dialect for Hibernate.
Most of tests passed. But some not. I start to research what was wrong, and in org.hibernate.test.collection.CollectionTest find mapping file that doesnt correct (order-by allowed only by column(s), not by expression as in hibernate_reference.pdf).

Code:
            order-by="lower(`attributeName`) asc"


in reference of Hibernate we have possibility to order by column(s) only, not by expression. (May be I have missed something in hibernate_reference.pdf?)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 03, 2006 11:54 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
well, I don't know what to tell ya. Guess it isn't supported by your database

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 03, 2006 12:01 pm 
Newbie

Joined: Fri Mar 03, 2006 6:49 am
Posts: 3
Just forget about DB (really DB doesnt support it!).

In test (written by Gavin King) we have error in hbm file.

map::order-by = "lower(`attributeName`) asc", and if you open HibRef you see order-by = "column[, columns] asc|desc".

Who can help me to clarify is it mistake or not?


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

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.