Could someone please explain to me the syntax of the collection attribute in the collection-cache element of hibernate.cfg.xml?
In my particular case, I've got a Department.hbm.xml which has:
Code:
<set
name="personnels"
lazy="true"
inverse="true"
>
<meta attribute="field-description">
@hibernate.set
lazy="true"
inverse="true"
@hibernate.collection-key
column="department_id"
@hibernate.collection-one-to-many
class="model.Personnel"
</meta>
<key>
<column name="department_id" />
</key>
<one-to-many
class="model.Personnel"
/>
</set>
I want the per-dept collections of personnel to be cached (to maximize the speed of "Iterator pitr = dept.getPersonnels().iterator();". I tried putting the following in hibernate.cfg.xml:
Code:
<collection-cache collection="model.Department" usage="read-write"/>
<collection-cache collection="model.Personnel" usage="read-write"/>
But i get a null pointer exception at at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1010).
I'm using Hibernate 2.1.
Any help would be greatly appreciated!