I have set the Cache with JBoss Core TreeCache, everything is working:
But I still have a problem:
I have a page 'viewEntity.xhtml'; this page is loaded with a parameter 'entityId'. I have a Stateless bean that is called the page is loaded (call from pages.xml), this bean gets the parameter 'entityId' and gets the Entity from the database. Finally the entity is outjected to viewEntity (with the scope PAGE).
Each time I display the viewEntity page I always get the Hibernate queries... I spends few hours to check my configuration and I finally understood where the problem is:
In 'viewEntity.xhtml' page, I have some EL expressions which need to load the some entity attributes, for exemple:
All these EL, need to get some data in database, and hibernate doing his job.. Creates the queries and executes queries to load 'att1' and 'att2'...
My problem is that these QUERIES are never cached..... Why ? I have some page, where 10 / 15 queries are created each time and the data is not changing often...
In persistence.xml, I have query-cache activated and second-level activated.
I spend my last day to search about it, but I didn't find any solution.
If someone knows about it... I invite him to take a coffee !