-->
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: Question on Second Level Caching
PostPosted: Tue Aug 29, 2006 11:24 am 
Newbie

Joined: Mon May 08, 2006 8:48 am
Posts: 4
Does Second Level Caching work on inserts?

Specifically, does Hibernate put the newly inserted record into the Second Level Cache upon successful insertion or the record or completion of transaction?

I have a situation where I am storing a object graph in one MDB, and would like to keep the data around after insertion, to be retreived by a second MDB later. I am thinking about using a distributed second level cache for this, but am not seeing the inserts happen when I test it.

Thanks in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 3:58 pm 
Newbie

Joined: Mon May 08, 2006 8:48 am
Posts: 4
So, looking at the hibernate source, there is no mention of caching in the DefaultSaveEventListener, and only around updates in the DefaultSaveOrUpdateEventListener, and all over the place in DefaultLoadEventListener.

So, the follow up question is why isn't there caching on inserts/saves? I understand that typically you do not need the data shortly after the insert, but what if you do?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 7:47 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
If I recall, there are some consistency reasons for Hibernate not to add elements on insertion. Distributed caching is a complex beast, and you don't want to retrieve staled data, do you ;-)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 30, 2006 2:50 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Actually it depends upon the cache concurrency strategy. Some concurrency strategies cache on insert, some don't. It's all about what consistency guarantees are made by the strategy.


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.