Hibernate version: 2.1.6
Name and version of the database you are using: Oracle 10g
Mapping documents:
Code:
<class name="Category" table="CATEGORY">
...
<property name="name" column="CATEGORY_NAME"/>
<many-to-one
name="parentCategory"
class="Category"
column="PARENT_CATEGORY_ID"
cascade="none"/>
<list
name="childCategories"
table="CATEGORY"
cascade="all"
inverse="true">
<key column="PARENT_CATEGORY_ID"/>
<index column="CATEGORY_CODE"/>
<one-to-many class="Category"/>
</list>
...
</class>
There are ~ 17500 total categories (actually it is not category in our application, I use category because there is a sample in Hibernate in Action like this, only difference is there was a set instead of list). When we try to load categories we always get "java.lang.outofmemoryerror". I know someone will send reply like
"Don't load all the table to session!".
But we are getting them to put into a dictionary to lookup in runtime (it will be used a lot and we don't want to go to database every time). We tried ScrollableResults and clearing session after every 20 category but result is same.
Is there a solution to this outofmemory problem?
Note: We searched the forum and read related posts (those we could find)