Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.2
Name and version of the database you are using: Oracle 10g
I have this somewhat verbose query
Code:
select sr.id, r.date_created, sr.product_group, sr.territory, u.unitid, u.code,
u.name, u.unit_typeid, u.countrytypeid, u.country, col.collectionid, col.code as col_code,
col.name as col_name, col.componenttypeid as col_componenttypeid, cs.cstateid, cs.code as cs_code,
cs.name as cs_name, cs.shortcode as cs_shortcode
from req r
inner join some_req sr on sr.id = r.id
inner join req_collection rc on rc.id = r.id
inner join collections col on col.collectionid = rc.collection_id
inner join req_cstate rcs on rcs.req_id = rc.id and rcs.collection_id = rc.collection_id
inner join cstates cs on cs.collectionid = rcs.collection_id and cs.cstateid = rcs.cstate_id
inner join unit_requr on ur.id = r.id
inner join units u on u.unitid = ur.unit_id
inner join user_units uu on uu.unit_id = ur.unit_id
inner join sessions s on s.user_id = uu.user_id where s.id = 833
I'm moving to Hibernate cause I require the use and simplicity of the Criteria artefacts but I don't think I can implement this query by associations (such as in the case where a class is associated by 2 properties). Can I mirror these inner joins with Criteria, I know I can use createAlias but how do I join objects at 2 points ? Any suggestions?