-
1. Re: How to setup 2nd level cache using only standalone.xml?
tdanecito May 31, 2012 11:52 AM (in response to tdanecito)Hi All,
I ended up adding a persistence.xml file in my EAR under META_INF and inside the xml file specifying my datasources (databases). It seemed to parse ok and and no errors in my server logs but I do not know how to verify the cache is being used yet. I made no change to my EJB code using annotations to specify caching so hope I am ok.
Regards,
-Tony
-
2. Re: How to setup 2nd level cache using only standalone.xml?
smarlow May 31, 2012 12:16 PM (in response to tdanecito)You can get the second level cache statistics with the AS/bin/jboss-cli tool. We probably should describe that in the JPA doc. The statistics are only available for Hibernate 4 currently.
After I have deployed jboss-javaee6-webapp.war (which already has statistics enabled by default via <property name="hibernate.generate_statistics" value="true"/>),I ran the jboss-cli tool and entered commands:
- connect – connects to the local as7 instance
- cd deployment – changed into deployments (you can enter an 'ls' command to see the deployments)
- cd jboss-javaee6-webapp.war – changed into my test app deployment
- cd subsystem – a view of the different subsystems are here (try an 'ls' to see them)
- cd jpa – change into the 'jpa' subsystem
- cd hibernate-persistence-unit – change into the Hibernate JPA persistence unit folder (all persistence units for deployment are here)
- cd jboss-javaee6-webapp.war#primary - change into the 'primary' persistence unit folder (using its fully qualified name)
- ls – will show basic statistics
- :write-attribute(name=enabled,value=true) – will enable statistics for the current persistence unit (false will disable)
- cd entity-cache - all entities that are enabled to have a second level cache are here
- cd org.jboss.tools.examples.modelMember - change into the 'modelMember' entity folder
- :read-resource(include-runtime=true) - show statistics for 'modelMember' entity second level cache
- pwd – show the current working directory
You should be able to do the same with your deployment (just remember to use the 'ls' command often to see the choices of what you can 'cd' into.)
-
3. Re: How to setup 2nd level cache using only standalone.xml?
tdanecito May 31, 2012 2:35 PM (in response to smarlow)Hi Scott,
Thanks for the info I will look at it tonight and let you know how it works out.
-Tony