类 ConnectionHolder

    • 方法详细资料

      • hasConnection

        protected boolean hasConnection()
        Return whether this holder currently has a Connection.
      • isTransactionActive

        protected boolean isTransactionActive()
        Return whether this holder represents an active, JDBC-managed transaction.
      • setConnection

        protected void setConnection​(@Nullable
                                     Connection connection)
        Override the existing Connection handle with the given Connection. Reset the handle if given null.

        Used for releasing the Connection on suspend (with a null argument) and setting a fresh Connection on resume.

      • getConnection

        public Connection getConnection()
        Return the current Connection held by this ConnectionHolder.

        This will be the same Connection until released gets called on the ConnectionHolder, which will reset the held Connection, fetching a new Connection on demand.

        另请参阅:
        ConnectionHandle.getConnection(), released()
      • supportsSavepoints

        public boolean supportsSavepoints()
                                   throws SQLException
        Return whether JDBC 3.0 Savepoints are supported. Caches the flag for the lifetime of this ConnectionHolder.
        抛出:
        SQLException - if thrown by the JDBC driver
      • createSavepoint

        public Savepoint createSavepoint()
                                  throws SQLException
        Create a new JDBC 3.0 Savepoint for the current Connection, using generated savepoint names that are unique for the Connection.
        返回:
        the new Savepoint
        抛出:
        SQLException - if thrown by the JDBC driver
      • released

        public void released()
        Releases the current Connection held by this ConnectionHolder.

        This is necessary for ConnectionHandles that expect "Connection borrowing", where each returned Connection is only temporarily leased and needs to be returned once the data operation is done, to make the Connection available for other operations within the same transaction.

        覆盖:
        released 在类中 ResourceHolderSupport