How to configure Hibernate statistics in Spring 3.0 application?

前端 未结 2 1880
死守一世寂寞
死守一世寂寞 2021-01-01 00:44

How do we configure such that we obtain Hibernate statistics through JMX in Spring MVC based web applications. Is there any better way of tracking Hibernate performance.

2条回答
  •  时光说笑
    2021-01-01 01:37

    Set hibernate.generate_statistics to true (either in persistence.xml or in hibernate.cfg.xml or in your session factory bean configuration). Then register this bean:

    
        
        
    
    

    (If you are not using JPA, just specify your sessionFactory bean instead of getting it through the EMF)

    And finally you need an mbean server and exporter:

    
        
    
    
    
        
        
        
                           
                
            
        
    
    

提交回复
热议问题