Class DefaultJdoDialect

    • Method Detail

      • getJdoIsolationLevel

        protected String getJdoIsolationLevel​(TransactionDefinition definition)
        Determine the JDO isolation level String to use for the given Spring transaction definition.
        Parameters:
        definition - the Spring transaction definition
        Returns:
        the corresponding JDO isolation level String, or null to indicate that no isolation level should be set explicitly
        See Also:
        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).

        Specified by:
        getJdbcConnection in interface JdoDialect
        Parameters:
        pm - the current JDO PersistenceManager
        readOnly - whether the Connection is only needed for read-only purposes
        Returns:
        a handle for the JDBC Connection, to be passed into releaseJdbcConnection, or null if no JDBC Connection can be retrieved
        Throws:
        javax.jdo.JDOException - if thrown by JDO methods
        SQLException - if thrown by JDBC methods
        See Also:
        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.

        Specified by:
        releaseJdbcConnection in interface JdoDialect
        Parameters:
        conHandle - the JDBC Connection handle to release
        pm - the current JDO PersistenceManager
        Throws:
        javax.jdo.JDOException - if thrown by JDO methods
        SQLException - if thrown by JDBC methods
        See Also:
        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.

        Parameters:
        ex - the JDOException, containing a SQLException
        Returns:
        the SQL String, or null if none found