类 DefaultJdoDialect

    • 方法详细资料

      • getJdoIsolationLevel

        protected String getJdoIsolationLevel​(TransactionDefinition definition)
        Determine the JDO isolation level String to use for the given Spring transaction definition.
        参数:
        definition - the Spring transaction definition
        返回:
        the corresponding JDO isolation level String, or null to indicate that no isolation level should be set explicitly
        另请参阅:
        Transaction.setIsolationLevel(String), Constants.TX_SERIALIZABLE, Constants.TX_REPEATABLE_READ, Constants.TX_READ_COMMITTED, Constants.TX_READ_UNCOMMITTED
      • getJdbcConnection

        public ConnectionHandle getJdbcConnection​(javax.jdo.PersistenceManager pm,
                                                  boolean readOnly)
                                           throws javax.jdo.JDOException,
                                                  SQLException
        This implementation returns a DataStoreConnectionHandle for JDO.

        NOTE: A JDO DataStoreConnection is always a wrapper, never the native JDBC Connection. If you need access to the native JDBC Connection (or the connection pool handle, to be unwrapped via a Spring NativeJdbcExtractor), override this method to return the native Connection through the corresponding vendor-specific mechanism.

        A JDO DataStoreConnection is only "borrowed" from the PersistenceManager: it needs to be returned as early as possible. Effectively, JDO requires the fetched Connection to be closed before continuing PersistenceManager work. For this reason, the exposed ConnectionHandle eagerly releases its JDBC Connection at the end of each JDBC data access operation (that is, on DataSourceUtils.releaseConnection).

        指定者:
        getJdbcConnection 在接口中 JdoDialect
        参数:
        pm - the current JDO PersistenceManager
        readOnly - whether the Connection is only needed for read-only purposes
        返回:
        a handle for the JDBC Connection, to be passed into releaseJdbcConnection, or null if no JDBC Connection can be retrieved
        抛出:
        javax.jdo.JDOException - if thrown by JDO methods
        SQLException - if thrown by JDBC methods
        另请参阅:
        PersistenceManager.getDataStoreConnection(), NativeJdbcExtractor, DataSourceUtils.releaseConnection(java.sql.Connection, javax.sql.DataSource)
      • releaseJdbcConnection

        public void releaseJdbcConnection​(ConnectionHandle conHandle,
                                          javax.jdo.PersistenceManager pm)
                                   throws javax.jdo.JDOException,
                                          SQLException
        This implementation does nothing, assuming that the Connection will implicitly be closed with the PersistenceManager.

        If the JDO provider returns a Connection handle that it expects the application to close, the dialect needs to invoke Connection.close here.

        指定者:
        releaseJdbcConnection 在接口中 JdoDialect
        参数:
        conHandle - the JDBC Connection handle to release
        pm - the current JDO PersistenceManager
        抛出:
        javax.jdo.JDOException - if thrown by JDO methods
        SQLException - if thrown by JDBC methods
        另请参阅:
        Connection.close()
      • extractSqlStringFromException

        protected String extractSqlStringFromException​(javax.jdo.JDOException ex)
        Template method for extracting a SQL String from the given exception.

        Default implementation always returns null. Can be overridden in subclasses to extract SQL Strings for vendor-specific exception classes.

        参数:
        ex - the JDOException, containing a SQLException
        返回:
        the SQL String, or null if none found