Class LocalDatabaseImpl

java.lang.Object
org.exolab.castor.jdo.engine.AbstractDatabaseImpl
org.exolab.castor.jdo.engine.LocalDatabaseImpl
All Implemented Interfaces:
Database

public class LocalDatabaseImpl extends AbstractDatabaseImpl
An implementation of the JDO
invalid reference
Database
interface supporting explicit local transaction demarcation.
Version:
$Revision: 8347 $ $Date: 2006-04-10 16:39:24 -0600 (Mon, 10 Apr 2006) $
Author:
Assaf Arkin, Bruce Snyder, Werner Guttmann
  • Constructor Details

  • Method Details

    • close

      public void close() throws PersistenceException
      Description copied from class: AbstractDatabaseImpl
      Closes the database. If a client transaction is in progress the transaction will be rolled back and an exception thrown. If an app-server transaction is in progress, the transaction will commit/rollback when triggered by the application server.
      Specified by:
      close in interface Database
      Specified by:
      close in class AbstractDatabaseImpl
      Throws:
      PersistenceException - An error occured while attempting to close the database
    • finalize

      protected void finalize() throws Throwable
      Overrides Object.finalize(). Outputs a warning message to the logs if the current DatabaseImpl instance still has valid scope. In this condition - a condition that ideally should not occur at all - we close the instance as well to free up resources.
      Overrides:
      finalize in class Object
      Throws:
      Throwable
      See Also:
    • begin

      public void begin() throws PersistenceException
      Description copied from class: AbstractDatabaseImpl
      Begin a new transaction. A transaction must be open in order to query and persist objects.
      Specified by:
      begin in interface Database
      Specified by:
      begin in class AbstractDatabaseImpl
      Throws:
      PersistenceException - A transaction is already open on this database, or an error reported by the persistence engine
    • commit

      Description copied from class: AbstractDatabaseImpl
      Commits and closes the transaction. All changes made to persistent objects during the transaction are made persistent; objects created during the transaction are made durable; and, objects removed during the transaction are removed from the database.

      In other words, any modifications to any data objects which are queried/loaded/created/update to this database is automatically stored to the database and visible to subsequence transactions. (ie. update is solely used for long transaction support and should not be called for any data object queried/loaded/created in the this transaction.)

      If the transaction cannot commit, the entire transaction rolls back and a TransactionAbortedException exception is thrown.

      After this method returns, the transaction is closed and all persistent objects are transient. Using Database.begin() to open a new transaction will not restore objects to their persistent stage.

      Specified by:
      commit in interface Database
      Specified by:
      commit in class AbstractDatabaseImpl
      Throws:
      TransactionNotInProgressException - Method called while transaction is not in progress
      TransactionAbortedException - The transaction cannot commit and has been rolled back
    • rollback

      public void rollback() throws TransactionNotInProgressException
      Description copied from class: AbstractDatabaseImpl
      Rolls back and closes the transaction. All changes made to persistent objects during the transaction are lost, objects created during the transaction are not made durable and objects removed during the transaction continue to exist.
      Specified by:
      rollback in interface Database
      Specified by:
      rollback in class AbstractDatabaseImpl
      Throws:
      TransactionNotInProgressException - Method called while transaction is not in progress
    • getJdbcConnection

      public Connection getJdbcConnection() throws PersistenceException
      Description copied from class: AbstractDatabaseImpl
      Gets the underlying JDBC connection. This is for advanced use only. Please make sure that you never close this Connection instance, as it will be closed by Castor.
      Specified by:
      getJdbcConnection in interface Database
      Specified by:
      getJdbcConnection in class AbstractDatabaseImpl
      Returns:
      the underlying JDBC connection, if present; otherwise null
      Throws:
      PersistenceException - If the underlying JDBC connection cannot be obtained.