Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:3.0.3
Mapping documents:
<hibernate-mapping default-lazy="true">
<class
name="com.mycompany.myapplication.pojo.TopLevelPOJO"
table="TOPLEVELPOJO"
schema="MYSCHEMANAME"
>
<many-to-one
name="assignedTo"
class="com.mycompamy.myapplication.data.pojo.MyForeignKeyPojo"
not-null="false"
outer-join="false"
lazy="true"
>
<column name="FOREIGN_KEY_POJO_ID" />
</many-to-one>
Code between sessionFactory.openSession() and session.close():
Criteria criteria = session.createCriteria(MyTopLevel.class);
criteria.addOrder(Order.desc("creationDate"));
criteria.setMaxResults(50);
return criteria.list();
Full stack trace of any exception that occurs:
Name and version of the database you are using: Oracle 9
The generated SQL (show_sql=true):
The SQL is first executed fine which gets the top level class, but then
SQL is executed to load the foreign key pojo, despite lazy="true"..
Debug level Hibernate log excerpt: