-->
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: How to use Hibernate criteria to write subqueries?
PostPosted: Wed Oct 05, 2011 1:03 am 
Newbie

Joined: Wed Oct 05, 2011 12:55 am
Posts: 1
Hi Guys,
I am newbie for using hibernate criteria queries
We have a applpication running and i have to make changes to existing criteria query

I know sql that will fetch me the reqd resultSet. But i dont know how to translate it to criteria

Below is my sql query
Code:
select h.employeeCode, h.yymm,sum(h.amount) as amt,COALESCE(d.lessamnt,0) from hist_sal h
left join
(select s.employeeCode as derivedempCode, sum(s.amount)as lessamnt from hist_sal s
where s.yymm between '200905' and '200908'group by s.employeeCode, s.yymm
)as d on d.derivedempCode = h.employeeCode and h.yymm between '200906' and '200907'
group by h.employeeCode, h.yymm ;

Its not that i am very new to criteria query but i cannot convert this above query in to criteria will you please help me for it. It will also me to understand concept of using subqueries in criteria


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.