-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: JPA and Hibernate statistics
PostPosted: Fri Jul 20, 2007 5:39 am 
Beginner
Beginner

Joined: Fri Apr 20, 2007 1:07 am
Posts: 23
Hello,

I need to get the Hibernate statistics using JPA...I was checking the JMX bean StatisticsService which helps in collection of statictics...Unfortunately I do not have a handle on SessionFactory as I use EntityManager and PersistenceContext...

Does anyone have a solution for this ?


Thanks...VJ


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 20, 2007 6:19 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
In persistence.xml:

Code:
            <property name="hibernate.generate_statistics" value="true"/>
            <property name="hibernate.session_factory_name" value="SessionFactories/mySF"/>


In your application startup code:

Code:
        log.info("registering Hibernate statistics MBean");
        hibernateMBeanName = new ObjectName("Hibernate:type=statistics,application=laceWiki");
        StatisticsService mBean = new StatisticsService();
        mBean.setSessionFactoryJNDIName("SessionFactories/mySF");
        ManagementFactory.getPlatformMBeanServer().registerMBean(mBean, hibernateMBeanName);

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 20, 2007 10:25 am 
Beginner
Beginner

Joined: Fri Apr 20, 2007 1:07 am
Posts: 23
Thanks Christian


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.