Here are two logs that should help track down the problem if it is in Hibernate:
- org.hibernate.engine.jdbc.internal.JdbcResourceRegistryImpl (trace)
- org.hibernate.SQL (debug).
----- Original Message -----
From: "Scott Marlow" <smarlow(a)redhat.com>
To: hibernate-dev(a)lists.jboss.org, "Jeremy Whiting"
Sent: Tuesday, September 20, 2011 7:22:57 AM
Subject: Re: [hibernate-dev] Using AS7 prepared Statement caching and Hibernate
4.0.0.Beta4 + 4.0.0.Beta5
This went away for a while but Jeremy is now recreating this
Can anyone tell us how long Hibernate 4.0.0 can hold onto a
PreparedStatement? And whether its possible that Hibernate may be
holding onto a PreparedStatement for reuse after Hibernate has called
the PreparedStatement.close method?
This problem goes away, if the AS7 PreparedStatement cache is
but for best performance, it would be nice to support using Hibernate
with a PreparedStatement cache.
Its possible that the bug is also in the AS7 PreparedStatement cache
that we just haven't found it yet.
What do you think?
On 08/04/2011 03:41 PM, Scott Marlow wrote:
> Let me add, that in theory, the AS7 prepared statement cache,
> should not
> close the prepared statements while they are in use by Hibernate.
> Currently in AS7, if the cache fills up, the statement should be
> from the pool but not closed.
> I still would like to understand why the prepared statement is
> closed while its still being used.
> On 08/04/2011 10:00 AM, Scott Marlow wrote:
reflects a problem
>> reported by
>> two users. One user reported, that in a transaction that included
>> multiple different entities being created, that Hibernate is
>> trying to
>> use a closed prepared statement.
>> My question at this point is, what would happen if the AS7
>> statement cache were to close a prepared statement during a
>> For example, assuming that the prepared statement cache was
>> to a very low limit, like two. After two unique sql statements
>> are in
>> the prepared statement cache, when a third unique sql statement is
>> created, one of the two cached statements will be closed. Could
>> Hibernate be holding onto one of these cached prepared statements
>> reuse in the transaction) that are closed?
>> Example execution order from user report:
>> 1. insert into ASSEMBLIES (NAME, A_ID) values (?, ?)
>> 2. other sql statements are executed.
>> 3. insert into ASSEMBLIES (NAME, A_ID) values (?, ?)
>> 4. other sql statements are executed.
>> 5. At this point, I believe that "insert into ASSEMBLIES (NAME,
>> values (?, ?)" could be aged out of the AS7 prepared statement
>> 6. "insert into ASSEMBLIES (NAME, A_ID) values (?, ?)" fails to
>> because of error
>> No operations allowed after statement closed"
>> For my local testing, I'm using H2 and get error
>> "org.h2.jdbc.JdbcSQLException: The object is already closed
>> Does/should Hibernate check the prepared statement to see if its
>> been closed before its reused in a transaction? Or should users
>> the AS7 prepared statement cache (current workaround)?
>> If Hibernate is currently checking if the prepared statement is
>> before reusing it, I must of missed that code in my inspection.
>> At this point, I'm still trying to find the root cause and answer
>> above question as well.
>> hibernate-dev mailing list
> hibernate-dev mailing list
hibernate-dev mailing list