-->
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: Select Query
PostPosted: Tue Oct 09, 2007 2:44 am 
Newbie

Joined: Tue Oct 09, 2007 2:33 am
Posts: 3
I need to query a table having data similar to something like:

Date Count
1/10/2007 10
2/10/2007 13
4/10/2007 11
6/10/2007 12

Notice that there is no data avaialble for 3rd and 5th; I expect the result to have something as shown below:

Date Count
1/10/2007 10
2/10/2007 13
3/10/2007 0
4/10/2007 11
5/10/2007 0
6/10/2007 12

This is not possible with a simple query; Is there anyway I can handle this using Hibernate features.

TIA
~vd


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 09, 2007 5:02 am 
Newbie

Joined: Thu Oct 04, 2007 5:00 am
Posts: 13
You can use Criteria
Criteria criteria = session.createCriteria(DateCount.class).
add(Restrictions.gt("count",new Long(0))).
addOrder(Order.asc("date"));

This will show the result as in the first table.

But if you want the output as in second table then I doubt current Hibernate version could help regarding that.
You need to retrive data in some data-structure such as (ArrayList, Vector) and show the result manually.


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.