Hibernate version: 2.1.7b
Mapping documents:
Code:
<class name="Category">
<id name="id" column="CATEGORY_ID"/>
...
<bag name="items"
lazy="true"
inverse="true"
cascade="all-delete-orphan">
<key column="CATEGORY_ID"/>
<one-to-many class="Item"/>
</bag>
</class>
<class name="Item">
<id name="id" column="ITEM_ID"/>
...
<many-to-one name="category
class="Category"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
foreign-key="FK1_CATEGORY_ID"
column="CATEGORY_ID"
not-null="true"
/>
</class>
Name and version of the database you are using: PostgreSQL 8.0RC2
I am using Hibernate, Spring and Struts. In my Action class I use the following code to get a list of items belong to a category:
Code:
Category category = categoryManager.getCategory(CATEGORY_ID);
category.getItems().size() // this works -- output the correct number of items
category.getItems() // It stops, doens't output anything... no exception.
I use the above code in my JUnit tests and it passed all the tests.
Any idea on what I am doing wrong? Have been trying to find a solution for days to this problem.
Thanks