-->
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.  [ 5 posts ] 
Author Message
 Post subject: problem with outer join
PostPosted: Tue Aug 30, 2005 8:20 am 
Newbie

Joined: Tue Aug 30, 2005 8:14 am
Posts: 5
hi all,
this is my sql query. Can anybody please write a HQL query for the same. This is very urgent. Thanking in advance.

SELECT DISTINCT os.acttype , os.objectid , sa.usecount
FROM studact sa
RIGHT OUTER JOIN objset os ON sa.studid = 12249


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 8:24 am 
Newbie

Joined: Tue Aug 30, 2005 8:14 am
Posts: 5
this is how i ported it to hql

select distinct os.ObjectId , sa.UseCount
from StudAct as sa
right outer join sa.ObjSet as os where sa.Student=12249

but this is giving me different results than the sql query. sql query is taking a cartesian product and somehow hibernate is not doing it.

please help me.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 8:48 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
imranjamadar wrote:
this is how i ported it to hql

select distinct os.ObjectId , sa.UseCount
from StudAct as sa
right outer join sa.ObjSet as os where sa.Student=12249

but this is giving me different results than the sql query. sql query is taking a cartesian product and somehow hibernate is not doing it.

please help me.


Your SQL Statement isn't joining on any columns which is why you're getting the cartesian product. The HQL is joining on the key column.

You HQL is doing a join on the key column, then filtering on student 12249.


Are you sure the SQL is what you really want ? Can you show your table definitions ?

_________________
Preston

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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 12:12 am 
Newbie

Joined: Tue Aug 30, 2005 8:14 am
Posts: 5
i am porting the procedures which are there in sql to hibernate so i dont have much freedom to change the sql. i have to just port it to hql and yes the sql is correct. i have to get the same results using hql that i am getting using sql. so please help.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 6:42 am 
Newbie

Joined: Tue Aug 30, 2005 8:14 am
Posts: 5
sorry the sql query was

SELECT DISTINCT os.acttype , os.objectid , sa.usecount
FROM studact sa RIGHT OUTER JOIN
objset os ON studid = 12249
AND os.objectid = sa.objsetid

please help me porting this query to HQL


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