-->
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.  [ 4 posts ] 
Author Message
 Post subject: reference read-only objects in another session
PostPosted: Wed May 18, 2005 8:44 am 
Newbie

Joined: Wed May 18, 2005 8:26 am
Posts: 2
For performance reasons I want to keep some often-used objects in memory. These objects are read-only and are referenced by other objects. For this reason I implemented a small cache.

However, I run into problems when referencing these objects, because I have another session then. If I have both sessions open, I get a "Illegal attempt to associate a collection with two open sessions" Exception. The same happens if I evict the object from the retrieval session. If I close the retrieval session, the programs runs through, but the object is updated, which I wanted to prevent.

Is there a possibility to reference read-only objects in a different session?

Hibernate version: 2.1.3


Top
 Profile  
 
 Post subject: Re: reference read-only objects in another session
PostPosted: Wed May 18, 2005 8:46 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
Harald.Pichler wrote:
For performance reasons I want to keep some often-used objects in memory. These objects are read-only and are referenced by other objects. For this reason I implemented a small cache.

However, I run into problems when referencing these objects, because I have another session then. If I have both sessions open, I get a "Illegal attempt to associate a collection with two open sessions" Exception. The same happens if I evict the object from the retrieval session. If I close the retrieval session, the programs runs through, but the object is updated, which I wanted to prevent.

Is there a possibility to reference read-only objects in a different session?

Hibernate version: 2.1.3


You can evict() the objects from the first session as you read them in, then the 2nd session won't have an issue.


Top
 Profile  
 
 Post subject: Re: reference read-only objects in another session
PostPosted: Wed May 18, 2005 8:55 am 
Newbie

Joined: Wed May 18, 2005 8:26 am
Posts: 2
pksiv wrote:
You can evict() the objects from the first session as you read them in, then the 2nd session won't have an issue.

The second session still updates the objects. Can I prevent this?


Top
 Profile  
 
 Post subject: Re: reference read-only objects in another session
PostPosted: Wed May 18, 2005 9:24 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
Harald.Pichler wrote:
pksiv wrote:
You can evict() the objects from the first session as you read them in, then the 2nd session won't have an issue.

The second session still updates the objects. Can I prevent this?


Look at the docs for the class-level attribute mutable=false.


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

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.