-->
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: How to obtain an object in secundary cache without clonning
PostPosted: Fri Aug 27, 2004 3:34 pm 
Newbie

Joined: Mon Aug 02, 2004 1:21 pm
Posts: 9
Hibernate version:
Hibernate 2.1.4 with ehcache 0.9
Mapping documents:
Code:
<class name="State" table="AMFLIBC.MBDLREP" lazy="false" mutable="false">
      <cache usage="read-only"/>
      <composite-id>
         <key-property name="countryCode" type="string" column="DLCOCD" access="field"/>
         <key-property name="code" type="string" column="DLBYCD" access="field"/>
      </composite-id>
      
      <property
         name="name"
         column="DLA7TX"
         type="string"
         access="field"
      />
</class>

Code between sessionFactory.openSession() and session.close():
Code:
Session session=sessionFactory.createSession();
State key = new State();
key.countryCode=countryCode;
key.code=stateCode;
State s=(State)session.get(State.class,key);


Name and version of the database you are using:
DB2 8.1

Cache configuration
Code:
<cache name="com.test.State"
        maxElementsInMemory="10000"
        eternal="true"
        timeToIdleSeconds="300"
        timeToLiveSeconds="600"
        overflowToDisk="false"
        />


Hello,

We are trying to obtain an object that is saved on the cache, but we need hibernate to return allways the same reference. The object is inmutable and it's cache property is set to "Read Only". However, although we are sure the object is saved in secondary cache, and the cache returns the same reference everytime, Hibernate seen to clone it and returns a different copy of the object.

Is there a way to change this behavior and make hibernate to return the same object in cache (without clonning it)?

Thanks.

_________________
Camilo A.


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.