Hello,
Using Hibernate 3.1
I have a problem to lazily load a collection. I have read the Hibernate Documentation and also Hibernate in Action (for Hibernate 2.0).
In the book and also the documentation I read that to lazily load a collection you need to set the flag lazy=true. I have done this, however for some reason my system still shows me Sql to load the objects that should only be loaded lazily!
I have an object representing a Case. The Case object then has a List object that contains Compenents. I have done the hbm.xml file for Case as follows:
Code:
<hibernate-mapping>
<class>
...
<list
name="newsletters"
lazy="true"
inverse="true"
cascade="all"
>
<key column="resource">
</key>
<index column="id" />
<one-to-many
class="com.sixpmodel.cvmanager.common.impl.BaseNewsletter"
/>
</list>
...
</class>
</hibernate-mapping>
However as already said, Hibernate is still loading me the childreen components. In my database I have a table called Case that has a one to many relationship with another table called Components. This is what I would like to ammulate in my objects. However I do not want to load all the Components in Case when I do not need them!
Can someone please tell me what I am doing wrong.
Thank You for all help.