[jboss-user] [EJB 3.0] - Basis question on 2nd level caches of ejb3 entities

CarstenRudat do-not-reply at jboss.com
Thu Apr 9 03:56:34 EDT 2009

Hi all,

I'm afraid, I have to ask a basis question...
I set up JBossCache as a 2nd-level cache for (hibernate) my ejb3-entities. I can see, that the cache is filled, by monitoring the mbean in jmx-console.

Now my question: A stateless (!) sessionbean uses an transactional EntityManager. A client calls sessionBean#findEntityWithId(...), then the SLSB returns (and with that ends the transaction). After that the client calls the same method with same parameters (i.e. "load" the same entity by its ID). 
Will the second call hit the cache or will the database accessed, because "after the first transaction, the cache will be discarded"?

In other words, does the 2nd-level cache lives longer than transaction boundaries?

Thanks for (this basic) information.

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

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

More information about the jboss-user mailing list