/** * Return whether the given Hibernate Session will always hold the same * JDBC Connection. This is used to check whether the transaction manager * can safely prepare and clean up the JDBC Connection used for a transaction. * <p>The default implementation checks the Session's connection release mode * to be "on_close". * @param session the Hibernate Session to check * @see ConnectionReleaseMode#ON_CLOSE */ @SuppressWarnings("deprecation") protected boolean isSameConnectionForEntireSession(Session session) { if (!(session instanceof SessionImplementor)) { // The best we can do is to assume we're safe. return true; } ConnectionReleaseMode releaseMode = ((SessionImplementor) session).getJdbcCoordinator().getConnectionReleaseMode(); return ConnectionReleaseMode.ON_CLOSE.equals(releaseMode); }
/** * Return whether the given Hibernate Session will always hold the same * JDBC Connection. This is used to check whether the transaction manager * can safely prepare and clean up the JDBC Connection used for a transaction. * <p>The default implementation checks the Session's connection release mode * to be "on_close". * @param session the Hibernate Session to check * @see ConnectionReleaseMode#ON_CLOSE */ @SuppressWarnings("deprecation") protected boolean isSameConnectionForEntireSession(Session session) { if (!(session instanceof SessionImplementor)) { // The best we can do is to assume we're safe. return true; } ConnectionReleaseMode releaseMode = ((SessionImplementor) session).getJdbcCoordinator().getConnectionReleaseMode(); return ConnectionReleaseMode.ON_CLOSE.equals(releaseMode); }
/** * Return whether the given Hibernate Session will always hold the same * JDBC Connection. This is used to check whether the transaction manager * can safely prepare and clean up the JDBC Connection used for a transaction. * <p>The default implementation checks the Session's connection release mode * to be "on_close". * @param session the Hibernate Session to check * @see ConnectionReleaseMode#ON_CLOSE */ @SuppressWarnings("deprecation") protected boolean isSameConnectionForEntireSession(Session session) { if (!(session instanceof SessionImplementor)) { // The best we can do is to assume we're safe. return true; } ConnectionReleaseMode releaseMode = ((SessionImplementor) session).getJdbcCoordinator().getConnectionReleaseMode(); return ConnectionReleaseMode.ON_CLOSE.equals(releaseMode); }