Hibernate version:2.1.6
Mapping documents:<class name="A" table="PB_ROLE" dynamic-update="true" dynamic-insert="true"> <id name="roleID" column="ROLE_ID"> <generator class="assigned"/> </id> <property name="description" column="DESCRIPTION" /> <many-to-one name="b" class="com.shk.jaf.application.security.service .domain.impl.Role" column="ROLE_ID_FK" unique="true" /> </class>
Code between sessionFactory.openSession() and session.close(): Role rr = (Role) session.createCriteria(A.class) .add(Expression.eq("roleID", new Integer(2))) .uniqueResult();
Full stack trace of any exception that occurs:
Name and version of the database you are using:Oracle 9i
The generated SQL (show_sql=true):select this.ROLE_ID as ROLE_ID1_, this.DESCRIPTION as DESCRIPT2_1_, t his.ROLE_ID_FK as ROLE_ID_FK1_, role1_.roleID as roleID0_, role1_.name as name0_ , role1_.created_On as created_On0_, role1_.created_By as created_By0_, role1_.u pdated_On as updated_On0_, role1_.updated_By as updated_By0_ from PB_ROLE this, Role role1_ where this.ROLE_ID=? and this.ROLE_ID_FK=role1_.roleID(+)
Debug level Hibernate log excerpt:
I have a object A with B associated object. However, I don't want to query A object and the Hibernate automatically fetch B Object.
How can I control fetching on all assoicated object (one-to-one, one-to-many )?
|