-->
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: Convert sql to HQL
PostPosted: Tue Oct 18, 2005 9:41 am 
Newbie

Joined: Wed Sep 14, 2005 4:57 am
Posts: 10
Can somebody help me to convert the following sql top HQL. Both of them are the same the on is just written with a join. Prefernce in solving the example with a join in HQL
Any help given will be gratly appreciated


select * from entry e, entry t
where e.id = t.id and e.isgroup ='true';


select * from entry e inner join entry t on e.id = t.id
where e.isgroup = 'true';



thanks


Top
 Profile  
 
 Post subject: Re: Convert sql to HQL
PostPosted: Tue Oct 18, 2005 11:24 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
meder wrote:
Can somebody help me to convert the following sql top HQL. Both of them are the same the on is just written with a join. Prefernce in solving the example with a join in HQL
Any help given will be gratly appreciated


select * from entry e, entry t
where e.id = t.id and e.isgroup ='true';


select * from entry e inner join entry t on e.id = t.id
where e.isgroup = 'true';



thanks

Code:
select e from Entry e inner join e.t  where e.isgroup = 'true'


If that isn't what you're looking for can you provide your mapping files ?

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 4:37 am 
Newbie

Joined: Wed Sep 14, 2005 4:57 am
Posts: 10
when i do your example above i get a empty result set.

in mysql i write the following command and it works perfect.
Code:
select * from entry e inner join entry t on e.id=t.member_of_id;


i think the problem lies in the fact that in the inner join i never compare the e.id to the t.member_of_id.
can some one explain how to do this comparison..


any help would be great

thank you


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.