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!)
|