Hibernate version: 3.0
Name and version of the database you are using: Oracle 10g
I am having trouble speeding up a simple many-to-one association, mapped with the following .hbm.xml configuration files:
Each one of these (Associates)...
Code:
<bag name="sessions" inverse="true" cascade="all-delete-orphan" lazy="false" order-by="ID">
<key column="ASSOCIATE_ID" />
<one-to-many class="com.tessco.filteradmin.pojo.AssociateSession"/>
</bag>
Has many of these (AssociateSessions)...
Code:
<many-to-one
name="associate"
class="com.tessco.filteradmin.pojo.Associate"
column="ASSOCIATE_ID"
update="false"
not-null="true" />
The problem I am having, and I know this is a newbie question, is how to deal with a huge number of records (millions of records, to be more specific). Turns out, not surprisingly, that when Hibernate tries to load up an Associate (creating the list of AssociateSessions along the way), it takes such a long time to load up all the records that the server/database cannot handle it (memory-wise and speed-wise).
I just dont know enough about this to really suggest a course of action. Can I use HQL to load a subset of the AssociateSessions to get around this? How do people solve a problem like this?
Any suggestions are welcome. Thanks in advance.