javax.transaction.Synchronization
, Database
public class GlobalDatabaseImpl extends AbstractDatabaseImpl implements javax.transaction.Synchronization
_autoStore, _callback, _classLoader, _ctx, _dbName, _instanceFactory, _lockTimeout, _scope
Constructor | Description |
---|---|
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.
|
Modifier and Type | Method | Description |
---|---|---|
void |
afterCompletion(int status) |
|
void |
beforeCompletion() |
|
void |
begin() |
Begin a new transaction.
|
void |
close() |
Closes the database.
|
void |
commit() |
Commits and closes the transaction.
|
protected void |
finalize() |
Overrides Object.finalize().
|
java.sql.Connection |
getJdbcConnection() |
Gets the underlying JDBC connection.
|
void |
rollback() |
Rolls back and closes the transaction.
|
(package private) void |
setTxMap(TxDatabaseMap txMap) |
create, getCacheManager, getClassLoader, getCurrentTransaction, getDatabaseName, getIdentity, getLockEngine, getNamedQuery, getNativeQuery, getOQLQuery, getOQLQuery, getQuery, getScope, getTransaction, isActive, isAutoStore, isClosed, isLocked, isPersistent, load, load, load, loadSynchronizables, lock, registerSynchronizables, remove, setAutoStore, toString, unregisterSynchronizables, update
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.public void close() throws PersistenceException
AbstractDatabaseImpl
close
in interface Database
close
in class AbstractDatabaseImpl
PersistenceException
- An error occured while
attempting to close the databaseprotected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
Object.finalize()
public void begin() throws PersistenceException
AbstractDatabaseImpl
begin
in interface Database
begin
in class AbstractDatabaseImpl
PersistenceException
- A transaction is already open on
this database, or an error reported by the persistence enginepublic void commit() throws TransactionNotInProgressException, TransactionAbortedException
AbstractDatabaseImpl
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.
commit
in interface Database
commit
in class AbstractDatabaseImpl
TransactionNotInProgressException
- Method called while
transaction is not in progressTransactionAbortedException
- The transaction cannot
commit and has been rolled backpublic void rollback() throws TransactionNotInProgressException
AbstractDatabaseImpl
rollback
in interface Database
rollback
in class AbstractDatabaseImpl
TransactionNotInProgressException
- Method called while
transaction is not in progresspublic void beforeCompletion()
beforeCompletion
in interface javax.transaction.Synchronization
public void afterCompletion(int status)
afterCompletion
in interface javax.transaction.Synchronization
void setTxMap(TxDatabaseMap txMap)
public java.sql.Connection getJdbcConnection() throws PersistenceException
AbstractDatabaseImpl
getJdbcConnection
in interface Database
getJdbcConnection
in class AbstractDatabaseImpl
PersistenceException
- If the underlying JDBC connection cannot be obtained.Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com