-->
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: how to use union option in createCriteria with projections
PostPosted: Mon Feb 11, 2008 6:29 am 
Beginner
Beginner

Joined: Fri Sep 28, 2007 4:58 am
Posts: 21
Location: Chennai, India
Hi,

i want to know how to write this two query in Hibernate using createCriteria along with projections.

1.
select sum(setteld_bal) from account_balances where clientaccount = 84 and bal_type_ind=1
union
select sum(setteld_bal) from account_balances where clientaccount = 84 and bal_type_ind=2

2.
select sum(setteld_bal), bal_type_ind from account_balances where clientaccount = 84 and bal_type_ind in (1,2)
group by bal_type_ind

_________________
Purushotham Podaralla


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 25, 2008 11:12 am 
Newbie

Joined: Mon Apr 07, 2008 1:32 pm
Posts: 7
Hibernate doesn't support UNION yet.

Another approach recommended by the Architect, was to use a view to generate your data and have hibernate map a Value Object to that view.


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.