[jboss-user] [JBossCache] - Re: Hibernate/Cache conceptual mismatch

steve.ebersole@jboss.com do-not-reply at jboss.com
Mon Aug 21 08:27:49 EDT 2006


Highly likely.

Consider 2 different Hibernate Sessions performing the same load concurrently:

session.load( MyEntity.class, new Long(1) );

And assume that MyEntity#1 is not currently in the cache.  So what happens?

Well, in response to the load from the first session Hibernate will load the data from the database and then perform the put into the cache, acquiring: (1) a read lock in the database and (2) a write lock in the cache.  

Now, the second load request gets processed.  So Hibernate checks the cache to see if the data exists there.  However, we have previously acquired a write lock in the other session so this process is blocked until that write lock is released when the first session ends its transaction.


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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966430



More information about the jboss-user mailing list