-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Caching of composite-elements in a List
PostPosted: Wed Oct 13, 2004 12:18 pm 
Newbie

Joined: Mon Sep 08, 2003 7:30 am
Posts: 17
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 (?, ?, ?, ?)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.