-->
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: orderBy in Criteria problem
PostPosted: Wed Apr 25, 2012 1:04 pm 
Newbie

Joined: Wed Apr 25, 2012 12:43 pm
Posts: 1
I have a person
Long id and a
String firstName;

I have a Criteria
getSession().createCriteria(Person.class).addOrder(Order.asc("firstName"))

In the DB I have in the Person Table
ID firstName
----------------------------------
1 AD
2 00
3 AB
Note tha 00 are 2 zeros

When I execute the criteriaI would like to have the correct result
2 00
3 AB
1 AD
This is also the result on sql developer when executing the sql query generated by the hibernate criteria, it gives expected and the correct result mentioned above
SELECT this_.ID AS ID0_1_,
this_.firstName AS firstName0_1_
FROM person this_
ORDER BY this_.firstName ASC

But after executing the criteria in java I have the following incorrect result
3 AB
1 AD
2 00

As you can see the 00 are put at the end instead of at the begingin of the result set.
I don't know what to do. In our office we are 5 developers.
2 have the correct result and 3 the incorrect result with the same code.

If anyone has an answer to my dilema please let me know.
Maybe some encoding on my pc ?
thanks for your replies


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.