-->
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.  [ 1 post ] 
Author Message
 Post subject: PrepareStatementCount very high
PostPosted: Thu Nov 20, 2008 1:15 pm 
Newbie

Joined: Sun Dec 30, 2007 1:08 pm
Posts: 14
Hi,
I have a simple program with about 10 queries that are executed several thousand times with different parameters. When I look at the Hibernate JMX statistics, I noticed that I get a PrepareStatementCount value that is very high (more like 10 * execution count).
It seems as if Hibernate is not reusing PreparedStatements for the 10 queries.
How do I have do program/configure Hibernate in order to get a PrepareStatementCount of 10 (which I would expect when using JDBC directly)?

I thought <property name="hibernate.c3p0.max_statements">200</property> would do the trick. But obviously it does not.

Do I have to keep the reference to the Query object that I receive when
calling session.getNamedQuery()?

I'm using Hibernate 3.2.6
with an Oracle 10g Database
a C3P0 connection pool
and named queries

Here is my Hibernate configuration (without mappings):

<property name="hibernate.connection.username">...</property>
<property name="hibernate.connection.password">...</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:....</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>

<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.generate_statistics">true</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.format_sql">false</property>
<property name="hibernate.jdbc.batch_size">50</property>

<property name="hibernate.c3p0.max_size">10</property>
<property name="hibernate.c3p0.min_size">10</property>
<property name="hibernate.c3p0.timeout">30000</property>
<property name="hibernate.c3p0.max_statements">200</property>
<property name="hibernate.c3p0.acquire_increment">2</property>


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

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.