-->
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 map hibernate joins
PostPosted: Mon Aug 09, 2010 5:18 am 
Newbie

Joined: Tue Aug 03, 2010 2:21 am
Posts: 3
select count(a.idconsumer )from ConsumerMsgcatSent a join ConsumerOffer b on (a.idconsumer=b.consumerId) where a.idconsumer =:idconsumer and b.noOffer >= (select count(c.idconsumer) from ConsumerMsgcatSent c where c.idconsumer =:idconsumer.

table1: ConsumerMsgcatSent
table2: ConsumerOffer

plz tel me how to execute this query in hibernate,
wat type of coding have to write wer.


Top
 Profile  
 
 Post subject: Re: how to map hibernate joins
PostPosted: Mon Aug 09, 2010 5:42 am 
Regular
Regular

Joined: Fri Aug 06, 2010 1:49 am
Posts: 102
Location: shynate26@gmail.com
Code:
Long count = (Long)session.createQuery("smp","select count(a.idconsumer )from ConsumerMsgcatSent a join ConsumerOffer b on (a.idconsumer=b.consumerId) where a.idconsumer =:idconsumer and b.noOffer >= (select count(c.idconsumer) from ConsumerMsgcatSent c where c.idconsumer =:idconsumer").setLong("idconsumer",value).uniqueResult();


Hope this helps.

_________________

Cheers!
Shynate
mailto:shynate26@gmail.com
www.CSSCORP.com


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.