org.tynamo.jpa.internal
Class JPATransactionManagerImpl

java.lang.Object
  extended by org.tynamo.jpa.internal.JPATransactionManagerImpl
All Implemented Interfaces:
EventListener, org.apache.tapestry5.ioc.services.ThreadCleanupListener, JPATransactionManager

public class JPATransactionManagerImpl
extends Object
implements JPATransactionManager, org.apache.tapestry5.ioc.services.ThreadCleanupListener


Constructor Summary
JPATransactionManagerImpl(JPAEntityManagerSource source)
           
 
Method Summary
 void abort()
          Aborts the current transaction, and starts a new transaction to replace it.
 void commit()
          Commits the current transaction (which will cause a flush of data to the database), then starts a new transaction to replace it.
 javax.persistence.EntityManager getEntityManager()
          Gets the active session for this request, creating it as necessary.
 void threadDidCleanup()
          Rollsback the transaction at the end of the request, then closes the session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPATransactionManagerImpl

public JPATransactionManagerImpl(JPAEntityManagerSource source)
Method Detail

abort

public void abort()
Description copied from interface: JPATransactionManager
Aborts the current transaction, and starts a new transaction to replace it.

Specified by:
abort in interface JPATransactionManager

commit

public void commit()
Description copied from interface: JPATransactionManager
Commits the current transaction (which will cause a flush of data to the database), then starts a new transaction to replace it.

Specified by:
commit in interface JPATransactionManager

getEntityManager

public javax.persistence.EntityManager getEntityManager()
Description copied from interface: JPATransactionManager
Gets the active session for this request, creating it as necessary. When the session is first created, a transaction is started.

Specified by:
getEntityManager in interface JPATransactionManager
Returns:
the request's entityManager
See Also:
JPAEntityManagerSource

threadDidCleanup

public void threadDidCleanup()
Rollsback the transaction at the end of the request, then closes the session. This means that any uncommitted changes are lost; code should inject the HSM and invoke commit() after making any changes, if they should persist.

Specified by:
threadDidCleanup in interface org.apache.tapestry5.ioc.services.ThreadCleanupListener


Copyright © 2009-2010. All Rights Reserved.