-->
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.  [ 3 posts ] 
Author Message
 Post subject: Unable to convert from SQL to HQL
PostPosted: Tue Oct 11, 2005 7:06 am 
Newbie

Joined: Wed Sep 14, 2005 4:57 am
Posts: 10
My sql code looks as follows

Code:
select e.id from entry e, groups_belong_to_group_member g where e.id=g.groups_belong_to_id and
group_entry='Yes' and
name like '%(Countries)%';


I have tried to convert this to HQL but only get this far
Code:
sb.append("select entry from com.workpool.directory.Entry entry where ");
sb.append("entry.groupEntry=\"Yes\" and ");
sb.append("entry.name like '%(Countries)%'");


i still need to add this code to the query
Code:
e.id=g.groups_belong_to_id
" g.groups_belong_to_id" is an object on entry so how do you get the entry.id = to a object on entry namely "g.groups_belong_to_id" using HQL, or what type of joion do i use

any help appreciated thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 8:26 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
if your group is part of entry you finish - hibernate will join tables


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 10:31 am 
Newbie

Joined: Wed Sep 14, 2005 4:57 am
Posts: 10
it is an aobject on the entry table, which is a entry itself
so i don't think hibernate will be able to determine the correct entry.

I tried to use a sub query but this not allowed in mysql so was hopeing there is some sort of join or someting

any help appreciated

thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.