-->
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.  [ 1 post ] 
Author Message
 Post subject: HQL query in one-to-many and subclass
PostPosted: Mon Dec 06, 2004 6:17 am 
Newbie

Joined: Wed Nov 24, 2004 7:58 pm
Posts: 9
Product and Attribute are one-to-many relation. Attribute has subclass AttributeColor and AttributeWeight and so on. How to query these product which has special color?

In native SQL, it would like this:
select product.* from product, attribute where product.id = attribute.pro_id and attribute.color = ?

But, in Hb, Attribute doesn't include pro_id property (instead, method in Product : Set getAttributes())

I also can't use left join in HQL,
from Product as pro left join pro.attributes as att where att.color=? (error, because Attribute is parent class of AttriuteColor, and it doesn't include color property!)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.