-->
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.  [ 2 posts ] 
Author Message
 Post subject: JUnit Test Hibernate
PostPosted: Wed Feb 06, 2013 9:40 am 
Newbie

Joined: Wed Feb 06, 2013 9:38 am
Posts: 1
Hallo,

ich möchte Hibernate ein bisschen näher unter die Lupe nehmen, auch hinsichtlich Performance-Tuning.

Gibt es eine Möglichkeit von einem Test die jeweiligen SQL-Statements zu zählen?

Gruß
naitsabes


Top
 Profile  
 
 Post subject: Re: JUnit Test Hibernate
PostPosted: Tue Feb 12, 2013 5:31 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Statistiken einschalten:

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


hibernateSessionFactory.getStatistics().getPrepareStatementCount();

oder

hibernateSessionFactory.getStatistics().getQueryExecutionCount();

Letzteres zaehlt allerdings nur User-Queries,
Queries die Hibernate beim Navigieren von Relationen erzeugt zaehlen nicht dazu.

P.S.: hibernateSessionFactory.getStatistics().clear(); setzt alle Zaehler auf 0.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.