-->
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.  [ 2 posts ] 
Author Message
 Post subject: Using Order in Criteria to sort Date without time
PostPosted: Thu Jan 15, 2015 3:08 pm 
Newbie

Joined: Thu Jan 15, 2015 2:58 pm
Posts: 1
Hi

In my DB I have a Requested by field that contains a date with time and a priority field (that is an integer)

i need to sort by Requested by without time and then priority. Is there a way to do this using Criteria ?

eg

criteria.addOrder(Order.asc("reqdate")); //But it should sort without the time component
criteria.addOrder(Order.asc("prioritycode"));

I need to remove the time in the Requested by sorting or else a record with Jan 1 1:00 pm Priority 3 would come before Jan 1 3:00 PM Priority 1
Ideally it should sort by Jan 1 only then by priority.


Top
 Profile  
 
 Post subject: Re: Using Order in Criteria to sort Date without time
PostPosted: Fri Jan 16, 2015 4:06 am 
Newbie

Joined: Mon Jan 12, 2015 3:56 am
Posts: 5
I would create @Formula field in entity on your place.
I doubt if there are other opportunities without extending base classes.


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