Hi,
I have a problem with caching composite-elements inside a list.
Whenever I load an instance of Test after having updated the results list, the results list gets initialized, which means a database SELECT is issued.
If I am right, this should not be the case, when caching for the list ist turned on, right?
Is the collection cache invalidated, when the collection is updated?
That's what I am doing:
load an instance of Test
update the results list (insert an element)
later ...
load the same instance of Test again
I could imagine, that Hibernate invalidates the cache, because it doesn't know, if the index columns have changed or not?
Thanx
Markus
Hibernate version: 2.1.6
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="de.olympus.odl.dms.core.bo.sample.Test" table="test">
<cache usage="read-write"/>
<id name="id" type="long">
<generator class="sequence">
<param name="sequence">test_sequence</param>
</generator>
</id>
<many-to-one name="testType" unique="false"/>
<list name="results" cascade="delete">
<cache usage="read-write"/>
<key column="test"/>
<index column="resultno"/>
<composite-element class="de.olympus.odl.dms.core.bo.sample.Result">
<property name="value"/>
<property name="repeat"/>
</composite-element>
</list>
</class>
</hibernate-mapping>
Name and version of the database you are using:
PostgreSQL 7.4.4
SQL output:
18:00:40,748 INFO [STDOUT] Hibernate: select results0_.test as test__, results0_.value as value__, results0_.repeat as repeat__, results0_.resultno as resultno__ from results results0_ where results0_.test=?
18:00:40,768 INFO [STDOUT] Hibernate: insert into results (test, resultno, value, repeat) values (?, ?, ?, ?)
|