Hibernate prepareConnection / prepared problems

As part of our project, we upgraded Spring to 4.3.14.RELEASEand Hibernate to 4.3.11.Final, and as we began to see two warnings:

  • WARN JDBC Connection to reset, not identical to the originally prepared connection - be sure to use the ON_CLOSE connection disconnect mode (default) and to start from Hibernate 4.2+ (or switch the HibernateJpaDialect prepareConnection flag to false

    • The exception is to switch the release mode to ON_CLOSEwhat we don’t want - when our application is under heavy load, at some point it stops releasing connections, and the application gets stuck. This works correctly with the output mode AFTER_TRANSACTION.
    • The message does not say what will happen if this error is ignored. Googling shows nothing final
    • What happens if we replace the flag prepareConnectionwith false? I tried to find such a flag in the Hibernate configuration, but could not find it.
  • GooGooStatementCache: 441 - Multiply Instructions!

    • Is this warning related to the previous one? Is this something we need to worry about?

EDIT: I updated Hibernate to 5.2.13.Final.

+6
source share
2 answers

Here is an explanation of the multiple prepared statements (from GooGooStatementCache Source ):

, , PreparedStatement, . , .

- , PreparedStatement Connection , PreparedStatement Connection. . Thread Connection , PreparedStatement ( ), . , , close() PreparedStatement, c3p0, Connection.

, , c3p0 . , , , ( close()-ing PreparedStatement ), . (0.9.5.2), c3p0 PreparedStatement.


, Spring/Hibernate. c3p0 Connection -, . Connection, Session, , . , - Session Connection Connection Session? , , .

+4

hibernate.connection.handling_mode

hibernate.connection.handling_mode=DELAYED_ACQUISITION_AND_HOLD

JTA

hibernate.connection.handling_mode=DELAYED_ACQUISITION_AND_RELEASE_AFTER_TRANSACTION

hibernate.connection.handling_mode=DELAYED_ACQUISITION_AND_RELEASE_AFTER_STATEMENT

. springframework javadoc setPrepareConnection

0

All Articles