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: HQL right outer join
PostPosted: Fri Jun 11, 2004 1:53 am 
Newbie

Joined: Fri Jun 11, 2004 1:22 am
Posts: 1
Location: India
Hi,

Am very new to Hibernate.
am using hibernate 2.0

I have this query in sql,

select ep.PRODUCT_ID, ep.product_Name, ep.available_Date,
count(distinct i.item_id) , count(distinct epc.comment_id)
from ec_products ep,
ec_Items i,
Ec_Product_Comments epc
where ep.PRODUCT_ID = i.product_id (+)
and ep.PRODUCT_ID = epc.product_id (+)
and i.item_State in ('to_be_shipped', 'shipped', 'arrived' )
GROUP BY ep.PRODUCT_ID, ep.product_Name, ep.available_Date
order by product_Name;


which i would like to convert to an hql query. The following is the hql query that i converted.

select ep.id, ep.productName, ep.availableDate, count(distinct i.id) ,
count(distinct epc.id)
from org.xyz.module.ecommerce.entity.BaseProduct as ep,
org.xyz.module.ecommerce.entity.Item as i,
org.xyz.module.ecommerce.entity.EcProductComments as
epc
where ep.id = i.product.id
and ep.id = epc.product.id
and i.itemState in ('to_be_shipped', 'shipped', 'arrived' )

GROUP BY ep.id, ep.productName, ep.availableDate ")


If I put a "(+)" at ep.id = i.product.id (+)
and ep.id = i.product.id (+)

It returns Old style of query.

Then i tried the other way,

ep.id = (+) i.product.id
and ep.id = (+) i.product.id


This returns the error as "java.sql.SQLException: ORA-00936: missing expression"

I dont know to use ansi convention.

Please help me out,

Regards,
Arunkumar Sreedharan


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 16, 2004 2:01 pm 
Beginner
Beginner

Joined: Mon Jun 07, 2004 4:21 pm
Posts: 44
Location: Boston
It's probably telling you to use "left outer join" or "right outer join" instead of the (+) in the syntax.


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.