-->
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.  [ 4 posts ] 
Author Message
 Post subject: How to fetch Date and Time using Order by Clause?
PostPosted: Fri Oct 19, 2007 11:19 am 
Newbie

Joined: Wed Oct 10, 2007 3:21 am
Posts: 3
Hi Friends,

I m trying to fetch the data from the db with order by as Created Date ,the Date contains the below structure

1. 17-OCT-07 05.54.48.807000000 PM
2. 17-OCT-07 05.56.41.051000000 PM
3. 18-OCT-07 11.03.33.477000000 AM
4. 17-OCT-07 08.16.24.906000000 PM

when i tried with order by it came in below order

result:3,1,2,4

Expected o/p: 3,4,2,1

Can you please any one help me how to write query using Critirions.




[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 24, 2007 7:52 am 
Regular
Regular

Joined: Mon Jan 22, 2007 10:32 am
Posts: 101
I too have some timestamp columns in db and sorting on such columns works fine for me.

Post some more info mapping, classes, etc., I might be able to help you.

_________________
Please rate this post if you find it helpful


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 24, 2007 7:58 am 
Newbie

Joined: Wed Oct 10, 2007 3:21 am
Posts: 3
<property name="createdDate" type="timestamp" column="date_created"></property>
<property name="modifiedDate" type="timestamp" column="date_modified"></property>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 29, 2007 7:08 am 
Regular
Regular

Joined: Mon Jan 22, 2007 10:32 am
Posts: 101
Not sure. I have almost similar properties defined in my mappings and things work fine for me.

_________________
Please rate this post if you find it helpful


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.