Exposing Hibernate (cache) statistics through JMX with Spring in Tomcat
问题 Collecting Hibernate/Ehcache statistics and exposing them through JMX in Spring-based setups seems easy. The Internet has lots of resources that help e.g. http://snippets.dzone.com/posts/show/11159 However, all those articles assume one is working with a Hibernate session factory of some sort. I'm not - my entities are JPA annotated and I use a javax.persistence.EntityManager . If I were deploying to a Java EE container I might have been able to obtain a Hibernate session factory through JNDI