|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.exolab.castor.jdo.engine.AbstractDatabaseImpl
org.exolab.castor.jdo.engine.GlobalDatabaseImpl
An implementation of the JDO database supporting explicit transaction demarcation.
| Field Summary |
| Fields inherited from class org.exolab.castor.jdo.engine.AbstractDatabaseImpl |
_autoStore, _callback, _classLoader, _ctx, _dbName, _instanceFactory, _lockTimeout, _scope |
| Fields inherited from interface org.exolab.castor.jdo.Database |
DbLocked, DBLOCKED, Exclusive, EXCLUSIVE, ReadOnly, READONLY, Shared, SHARED |
| Constructor Summary | |
GlobalDatabaseImpl(java.lang.String dbName,
int lockTimeout,
CallbackInterceptor callback,
InstanceFactory instanceFactory,
javax.transaction.Transaction transaction,
java.lang.ClassLoader classLoader,
boolean autoStore,
boolean isPoolInUseForGlobalTransactions)
Creates an instance of this class. |
|
| Method Summary | |
void |
afterCompletion(int status)
|
void |
beforeCompletion()
|
void |
begin()
Begin a new transaction. A transaction must be open in order to query and persist objects. |
void |
close()
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. |
void |
commit()
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
After this method returns, the transaction is closed and all
persistent objects are transient. Using |
protected void |
finalize()
Overrides Object.finalize(). |
java.sql.Connection |
getJdbcConnection()
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. |
void |
rollback()
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. |
(package private) void |
setTxMap(TxDatabaseMap txMap)
|
| Methods inherited from class org.exolab.castor.jdo.engine.AbstractDatabaseImpl |
create, getCacheManager, getClassLoader, getCurrentTransaction, getDatabaseName, getIdentity, getLockEngine, getNamedQuery, getOQLQuery, getOQLQuery, getQuery, getScope, getTransaction, isActive, isAutoStore, isClosed, isLocked, isPersistent, load, load, load, loadSynchronizables, lock, registerSynchronizables, remove, setAutoStore, toString, unregisterSynchronizables, update |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public GlobalDatabaseImpl(java.lang.String dbName,
int lockTimeout,
CallbackInterceptor callback,
InstanceFactory instanceFactory,
javax.transaction.Transaction transaction,
java.lang.ClassLoader classLoader,
boolean autoStore,
boolean isPoolInUseForGlobalTransactions)
throws DatabaseNotFoundException
dbName - Database name.lockTimeout - Lock timeout.callback - Callback interceptors.instanceFactory - Instance factory to use.transaction - Current XA transaction.classLoader - Current class loader.autoStore - True if auto-storing is enabled.isPoolInUseForGlobalTransactions - True if Database instanced should be cached.
DatabaseNotFoundException - If the specified database cannot be found.| Method Detail |
public void close()
throws PersistenceException
AbstractDatabaseImpl
close in interface Databaseclose in class AbstractDatabaseImplPersistenceExceptionDatabase.close()
protected void finalize()
throws java.lang.Throwable
java.lang.ThrowableObject.finalize()
public void begin()
throws PersistenceException
AbstractDatabaseImpl
begin in interface Databasebegin in class AbstractDatabaseImplPersistenceException
public void commit()
throws TransactionNotInProgressException,
TransactionAbortedException
AbstractDatabaseImplIn 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.
commit in interface Databasecommit in class AbstractDatabaseImplTransactionNotInProgressException
TransactionAbortedException
public void rollback()
throws TransactionNotInProgressException
AbstractDatabaseImpl
rollback in interface Databaserollback in class AbstractDatabaseImplTransactionNotInProgressExceptionpublic void beforeCompletion()
beforeCompletion in interface javax.transaction.Synchronizationpublic void afterCompletion(int status)
afterCompletion in interface javax.transaction.SynchronizationSynchronization.afterCompletion(int)void setTxMap(TxDatabaseMap txMap)
public java.sql.Connection getJdbcConnection()
throws PersistenceException
AbstractDatabaseImpl
getJdbcConnection in interface DatabasegetJdbcConnection in class AbstractDatabaseImplPersistenceException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||