Hey,

I'm trying to use some 2nd level caching in Hibernate, TreeCache in particular, 
but the problem seems to concern any cache provider. 
Here is simplified algorithm of what is going on:

for i=0..100
Transaction.begin (JTA or Hib)
hibernateTemplate.load()
//some business logic that updates the loaded entity
hibTemplate.update()
Transaction.commit()

In first iteration, load searches the cache and it misses for the first time. 
Db fetch. Saved into cache. Sool. And here comes the update. The entity has 
changed meanwhile (i.e. some counter increased). Unfortunatelly update doesn;t 
update in cache, but instead issues db updates:(

Any subsequent iteration gets entity from cache, but its stale (still the one 
that was stored in first iteration after cache miss-hit)

What's the magic about that updating in cache?

Some conf details:
-hib3
- (for TreeCache) in entity mapping
-jotm as jta transaction manager
-treecache.xml with some slight changes, but default one behaves same way

I dont really think it;s a conf problem, I guess it;s rather my 
misunderstanding of 2nd level caching or wrong approach, I dont know. 
Logically, I really think it should do the update in cache instead of db, 
especially in case of fully transactional cache like TreeCache. The db update 
should follow the eviction policy of the cache.

Well I will appreciate any explaination and help 

Thanks
M.





View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959840#3959840

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959840
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to