org.springframework.orm.jdo
Interface JdoDialect


public interface JdoDialect

Strategy that encapsulates certain functionality that standard JDO 1.0 does not offer despite being relevant in the context of O/R mapping, like access to the underlying JDBC connection and explicit flushing of changes to the database.

To be implemented for specific JDO implementations like Kodo, Lido, or JDO Genie. Almost every O/R-based JDO implementation will offer proprietary means to access the underlying JDBC Connection and to explicitly flush changes. JDO 2.0 respectively JDO/R 2.0 are likely to define standard ways for these: If applicable, a JdoDialect implementation for JDO 2.0 will be provided to leverage them with Spring's JDO support.

Since:
02.11.2003
Author:
Juergen Hoeller

Method Summary
 void flush(javax.jdo.PersistenceManager pm)
          Flush the given persistence manager, i.e.
 java.sql.Connection getJdbcConnection(javax.jdo.PersistenceManager pm)
          Retrieve the JDBC connection that the given JDO persistence manager uses underneath, if accessing a relational database.
 DataAccessException translateException(javax.jdo.JDOException ex)
          Translate the given JDOException to a corresponding exception from Spring's generic DataAccessException hierarchy.
 

Method Detail

getJdbcConnection

public java.sql.Connection getJdbcConnection(javax.jdo.PersistenceManager pm)
                                      throws javax.jdo.JDOException
Retrieve the JDBC connection that the given JDO persistence manager uses underneath, if accessing a relational database. This method will just get invoked if actually needing access to the underlying JDBC connection.

This strategy is necessary as JDO 1.0 does not provide a standard way to retrieve the underlying JDBC Connection (due to the fact that a JDO implementation might not work with a relational database at all).

Parameters:
pm - the current JDO persistence manager
Returns:
the underlying JDBC connection
Throws:
javax.jdo.JDOException - in case of retrieval errors
See Also:
JdoTransactionManager.setDataSource(javax.sql.DataSource)

flush

public void flush(javax.jdo.PersistenceManager pm)
           throws javax.jdo.JDOException
Flush the given persistence manager, i.e. flush all changes (that have been applied to persistent objects) to the underlying database. This method will just get invoked if eager flushing is actually necessary, for example if JDBC access code needs to see changes within the same transaction.

Parameters:
pm - the current JDO persistence manager
Throws:
javax.jdo.JDOException - in case of errors
See Also:
JdoAccessor.setFlushEager(boolean)

translateException

public DataAccessException translateException(javax.jdo.JDOException ex)
Translate the given JDOException to a corresponding exception from Spring's generic DataAccessException hierarchy. An implementation should apply PersistenceManagerFactoryUtils' standard exception translation if can't do anything more specific.

Of particular importance is the correct translation to ObjectRetrievalFailureException, ObjectOptimisticLockingFailureException, and DataIntegrityViolationException. Unfortunately, standard JDO does not allow for portable detection of those.

Parameters:
ex - the JDOException thrown
Returns:
the corresponding DataAccessException (must not be null)
See Also:
JdoAccessor.convertJdoAccessException(javax.jdo.JDOException), JdoTransactionManager.convertJdoAccessException(javax.jdo.JDOException), PersistenceManagerFactoryUtils.convertJdoAccessException(javax.jdo.JDOException), ObjectRetrievalFailureException, ObjectOptimisticLockingFailureException, DataIntegrityViolationException


Copyright (C) 2003-2004 The Spring Framework Project.