-->
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 retrieve the data from different tables using joins
PostPosted: Wed Apr 21, 2004 6:46 am 
Newbie

Joined: Mon Apr 19, 2004 10:12 am
Posts: 19
Location: India
Hi,
Anybody pls let me know how to retrieve the selected fields from the different tables using join conditions in hibernate with some example.

the query as follows

the query is
createSQLQuery("select {cvo}.customeridvc,{cvo}.customernamevc,{cvo}.shortnamevc,{cvo}.creditstatusvc,{cgvo}.groupnamevc from customer as {cvo}
left outer join customergroup as {cgvo} on cgvo.custgroupidvc=cgvo.custgroupidvc");


Iam getting an exception when executing the above code as follows:

ERROR [STDERR] net.sf.hibernate.QueryException: Alias does not correspond to any of the supplied return aliases = {[cvo]}

Thanks for your advise on this subject

_________________
Ravi Kumar


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 21, 2004 7:34 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Query sqlQuery = sess.createSQLQuery("select {cat.*} from cats {cat}", "cat", Cat.class);
sqlQuery.setMaxResults(50);
List cats = sqlQuery.list();

it's in the doc you need to specify which class has to be used with your alias


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.