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>
|