Top Description Inners Fields Constructors Methods
org.hibernate.engine.transaction.jta.platform.internal

public Class WebSphereExtendedJtaPlatform

extends AbstractJtaPlatform
Class Inheritance
Imports
java.lang.reflect.InvocationHandler, .Method, .Proxy, javax.transaction.NotSupportedException, .RollbackException, .Status, .Synchronization, .SystemException, .Transaction, .TransactionManager, .UserTransaction, javax.transaction.xa.XAResource, org.hibernate.HibernateException

JTA platform implementation intended for use with WebSphere Application Server (WAS).

WAS, unlike every other app server on the planet, does not allow direct access to the JTS TransactionManager. Instead, for common transaction-related tasks users must utilize a proprietary API known as ExtendedJTATransaction.

Even more unfortunate, the exact TransactionManagerLookup to use inside of WAS is highly dependent upon

This class is reported to work on WAS version 6 in any of the standard J2EE/Java EE component containers.

Authors
Gavin King,

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class

Field Summary

Modifier and TypeField and Description
public static final String

Constructor Summary

AccessConstructor and Description
public

Field Detail

UT_NAMEback to summary
public static final String UT_NAME

Constructor Detail

WebSphereExtendedJtaPlatformback to summary
public WebSphereExtendedJtaPlatform()

Method Detail

canCacheTransactionManagerback to summary
protected boolean canCacheTransactionManager()

Overrides org.hibernate.engine.transaction.jta.platform.internal.AbstractJtaPlatform.canCacheTransactionManager.

Annotations
@Override
getTransactionIdentifierback to summary
public Object getTransactionIdentifier(Transaction transaction)

Overrides org.hibernate.engine.transaction.jta.platform.internal.AbstractJtaPlatform.getTransactionIdentifier.

Implements org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform.getTransactionIdentifier.

Doc from org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform.getTransactionIdentifier.

Determine an identifier for the given transaction appropriate for use in caching/lookup usages.

Generally speaking the transaction itself will be returned here. This method was added specifically for use in WebSphere and other unfriendly Java EE containers.

Parameters
transaction:Transaction

The transaction to be identified.

Returns:Object

An appropriate identifier

Annotations
@Override
locateTransactionManagerback to summary
protected TransactionManager locateTransactionManager()

Implements abstract org.hibernate.engine.transaction.jta.platform.internal.AbstractJtaPlatform.locateTransactionManager.

Annotations
@Override
locateUserTransactionback to summary
protected UserTransaction locateUserTransaction()

Implements abstract org.hibernate.engine.transaction.jta.platform.internal.AbstractJtaPlatform.locateUserTransaction.

Annotations
@Override
org.hibernate.engine.transaction.jta.platform.internal back to summary

public Class WebSphereExtendedJtaPlatform.TransactionManagerAdapter

extends Object
implements TransactionManager
Class Inheritance
  • java.lang.Object
  • org.hibernate.engine.transaction.jta.platform.internal.WebSphereExtendedJtaPlatform.TransactionManagerAdapter
All Implemented Interfaces
javax.transaction.TransactionManager

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class

Field Summary

Modifier and TypeField and Description
private Object
private final Method
private final Method
private final Class<T>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
begin()

Implements javax.transaction.TransactionManager.begin.

Create a new transaction and associate it with the current thread.
public void
commit()

Implements javax.transaction.TransactionManager.commit.

Complete the transaction associated with the current thread.
public int
getStatus()

Implements javax.transaction.TransactionManager.getStatus.

Obtain the status of the transaction associated with the current thread.
public Transaction
getTransaction()

Implements javax.transaction.TransactionManager.getTransaction.

Get the transaction object that represents the transaction context of the calling thread.
public void
resume(Transaction
The Transaction object that represents the transaction to be resumed.
txn
)

Implements javax.transaction.TransactionManager.resume.

Resume the transaction context association of the calling thread with the transaction represented by the supplied Transaction object.
public void
rollback()

Implements javax.transaction.TransactionManager.rollback.

Roll back the transaction associated with the current thread.
public void
setRollbackOnly()

Implements javax.transaction.TransactionManager.setRollbackOnly.

Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.
public void
setTransactionTimeout(int
The value of the timeout in seconds. If the value is zero, the transaction service restores the default value. If the value is negative a SystemException is thrown.
i
)

Implements javax.transaction.TransactionManager.setTransactionTimeout.

Modify the timeout value that is associated with transactions started by the current thread with the begin method.
public Transaction
suspend()

Implements javax.transaction.TransactionManager.suspend.

Suspend the transaction currently associated with the calling thread and return a Transaction object that represents the transaction context being suspended.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

extendedJTATransactionback to summary
private Object extendedJTATransaction
getLocalIdMethodback to summary
private final Method getLocalIdMethod
registerSynchronizationMethodback to summary
private final Method registerSynchronizationMethod
synchronizationCallbackClassback to summary
private final Class<T> synchronizationCallbackClass

Constructor Detail

TransactionManagerAdapterback to summary
private TransactionManagerAdapter() throws HibernateException

Method Detail

beginback to summary
public void begin() throws NotSupportedException, SystemException

Implements javax.transaction.TransactionManager.begin.

Doc from javax.transaction.TransactionManager.begin.

Create a new transaction and associate it with the current thread.

Annotations
@Override
Exceptions
NotSupportedException:
Thrown if the thread is already associated with a transaction and the Transaction Manager implementation does not support nested transactions.
SystemException:
Thrown if the transaction manager encounters an unexpected error condition.
commitback to summary
public void commit() throws UnsupportedOperationException

Implements javax.transaction.TransactionManager.commit.

Doc from javax.transaction.TransactionManager.commit.

Complete the transaction associated with the current thread. When this method completes, the thread is no longer associated with a transaction.

Annotations
@Override
getStatusback to summary
public int getStatus() throws SystemException

Implements javax.transaction.TransactionManager.getStatus.

Doc from javax.transaction.TransactionManager.getStatus.

Obtain the status of the transaction associated with the current thread.

Returns:int

The transaction status. If no transaction is associated with the current thread, this method returns the Status.NoTransaction value.

Annotations
@Override
Exceptions
SystemException:
Thrown if the transaction manager encounters an unexpected error condition.
getTransactionback to summary
public Transaction getTransaction() throws SystemException

Implements javax.transaction.TransactionManager.getTransaction.

Doc from javax.transaction.TransactionManager.getTransaction.

Get the transaction object that represents the transaction context of the calling thread.

Returns:Transaction

the Transaction object representing the transaction associated with the calling thread.

Annotations
@Override
Exceptions
SystemException:
Thrown if the transaction manager encounters an unexpected error condition.
resumeback to summary
public void resume(Transaction txn) throws UnsupportedOperationException

Implements javax.transaction.TransactionManager.resume.

Doc from javax.transaction.TransactionManager.resume.

Resume the transaction context association of the calling thread with the transaction represented by the supplied Transaction object. When this method returns, the calling thread is associated with the transaction context specified.

Parameters
txn:Transaction

The Transaction object that represents the transaction to be resumed.

Annotations
@Override
rollbackback to summary
public void rollback() throws UnsupportedOperationException

Implements javax.transaction.TransactionManager.rollback.

Doc from javax.transaction.TransactionManager.rollback.

Roll back the transaction associated with the current thread. When this method completes, the thread is no longer associated with a transaction.

Annotations
@Override
setRollbackOnlyback to summary
public void setRollbackOnly() throws UnsupportedOperationException

Implements javax.transaction.TransactionManager.setRollbackOnly.

Doc from javax.transaction.TransactionManager.setRollbackOnly.

Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.

Annotations
@Override
setTransactionTimeoutback to summary
public void setTransactionTimeout(int i) throws UnsupportedOperationException

Implements javax.transaction.TransactionManager.setTransactionTimeout.

Doc from javax.transaction.TransactionManager.setTransactionTimeout.

Modify the timeout value that is associated with transactions started by the current thread with the begin method.

If an application has not called this method, the transaction service uses some default value for the transaction timeout.

Parameters
i:int

The value of the timeout in seconds. If the value is zero, the transaction service restores the default value. If the value is negative a SystemException is thrown.

Annotations
@Override
suspendback to summary
public Transaction suspend() throws UnsupportedOperationException

Implements javax.transaction.TransactionManager.suspend.

Doc from javax.transaction.TransactionManager.suspend.

Suspend the transaction currently associated with the calling thread and return a Transaction object that represents the transaction context being suspended. If the calling thread is not associated with a transaction, the method returns a null object reference. When this method returns, the calling thread is not associated with a transaction.

Returns:Transaction

Transaction object representing the suspended transaction.

Annotations
@Override
org.hibernate.engine.transaction.jta.platform.internal back to summary

public Class WebSphereExtendedJtaPlatform.TransactionManagerAdapter.TransactionAdapter

extends Object
implements Transaction
Class Inheritance
  • java.lang.Object
  • org.hibernate.engine.transaction.jta.platform.internal.WebSphereExtendedJtaPlatform.TransactionManagerAdapter.TransactionAdapter
All Implemented Interfaces
javax.transaction.Transaction

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
commit()

Implements javax.transaction.Transaction.commit.

Complete the transaction represented by this Transaction object.
public boolean
delistResource(XAResource
The XAResource object associated with the resource (connection).
resource
,
int
One of the values of TMSUCCESS, TMSUSPEND, or TMFAIL.
i
)

Implements javax.transaction.Transaction.delistResource.

Disassociate the resource specified from the transaction associated with the target Transaction object.
public boolean
enlistResource(XAResource
The XAResource object associated with the resource (connection).
resource
)

Implements javax.transaction.Transaction.enlistResource.

Enlist the resource specified with the transaction associated with the target Transaction object.
public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
private Object
public int
getStatus()

Implements javax.transaction.Transaction.getStatus.

Obtain the status of the transaction associated with the target Transaction object.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public void
registerSynchronization(final Synchronization
The Synchronization object for the transaction associated with the target object.
synchronization
)

Implements javax.transaction.Transaction.registerSynchronization.

Register a synchronization object for the transaction currently associated with the target object.
public void
rollback()

Implements javax.transaction.Transaction.rollback.

Rollback the transaction represented by this Transaction object.
public void
setRollbackOnly()

Implements javax.transaction.Transaction.setRollbackOnly.

Modify the transaction associated with the target object such that the only possible outcome of the transaction is to roll back the transaction.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Constructor Detail

TransactionAdapterback to summary
private TransactionAdapter()

Method Detail

commitback to summary
public void commit() throws UnsupportedOperationException

Implements javax.transaction.Transaction.commit.

Doc from javax.transaction.Transaction.commit.

Complete the transaction represented by this Transaction object.

Annotations
@Override
delistResourceback to summary
public boolean delistResource(XAResource resource, int i) throws UnsupportedOperationException

Implements javax.transaction.Transaction.delistResource.

Doc from javax.transaction.Transaction.delistResource.

Disassociate the resource specified from the transaction associated with the target Transaction object.

Parameters
resource:XAResource

The XAResource object associated with the resource (connection).

i:int

One of the values of TMSUCCESS, TMSUSPEND, or TMFAIL.

Returns:boolean

true if the resource was delisted successfully; otherwise false.

Annotations
@Override
enlistResourceback to summary
public boolean enlistResource(XAResource resource) throws UnsupportedOperationException

Implements javax.transaction.Transaction.enlistResource.

Doc from javax.transaction.Transaction.enlistResource.

Enlist the resource specified with the transaction associated with the target Transaction object.

Parameters
resource:XAResource

The XAResource object associated with the resource (connection).

Returns:boolean

true if the resource was enlisted successfully; otherwise false.

Annotations
@Override
equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getLocalIdback to summary
private Object getLocalId() throws HibernateException
getStatusback to summary
public int getStatus()

Implements javax.transaction.Transaction.getStatus.

Doc from javax.transaction.Transaction.getStatus.

Obtain the status of the transaction associated with the target Transaction object.

Returns:int

The transaction status. If no transaction is associated with the target object, this method returns the Status.NoTransaction value.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
registerSynchronizationback to summary
public void registerSynchronization(final Synchronization synchronization) throws RollbackException, IllegalStateException, SystemException

Implements javax.transaction.Transaction.registerSynchronization.

Doc from javax.transaction.Transaction.registerSynchronization.

Register a synchronization object for the transaction currently associated with the target object. The transction manager invokes the beforeCompletion method prior to starting the two-phase transaction commit process. After the transaction is completed, the transaction manager invokes the afterCompletion method.

Parameters
synchronization:Synchronization

The Synchronization object for the transaction associated with the target object.

Annotations
@Override
Exceptions
RollbackException:
Thrown to indicate that the transaction has been marked for rollback only.
IllegalStateException:
Thrown if the transaction in the target object is in the prepared state or the transaction is inactive.
SystemException:
Thrown if the transaction manager encounters an unexpected error condition.
rollbackback to summary
public void rollback() throws UnsupportedOperationException

Implements javax.transaction.Transaction.rollback.

Doc from javax.transaction.Transaction.rollback.

Rollback the transaction represented by this Transaction object.

Annotations
@Override
setRollbackOnlyback to summary
public void setRollbackOnly() throws UnsupportedOperationException

Implements javax.transaction.Transaction.setRollbackOnly.

Doc from javax.transaction.Transaction.setRollbackOnly.

Modify the transaction associated with the target object such that the only possible outcome of the transaction is to roll back the transaction.

Annotations
@Override