org.krakenapps.jpa.impl
Class ThreadLocalEntityManagerServiceImpl

java.lang.Object
  extended by org.krakenapps.jpa.impl.ThreadLocalEntityManagerServiceImpl
All Implemented Interfaces:
ThreadLocalEntityManagerService

public class ThreadLocalEntityManagerServiceImpl
extends java.lang.Object
implements ThreadLocalEntityManagerService

Implementation for thread local entity manager service interface

Author:
xeraph

Constructor Summary
ThreadLocalEntityManagerServiceImpl()
           
 
Method Summary
 void beginTransaction()
          Begin transaction in current thread context
 void beginTransaction(boolean failOnActiveTransaction)
          Begin transaction in current thread context, but throw exception if transaction is already active.
 void closeEntityManager()
          Close entity manager in current thread context
 void commitTransaction()
          Commit transaction in current thread context
 javax.persistence.EntityManager getEntityManager()
          Get the entity manager for current thread context
 void rollbackTransaction()
          Rollback transaction in current thread context
 void setEntityManagerFactory(java.lang.String factoryName)
          Set an entity manager factory of current thread context
 void setRollbackOnlyTransaction()
          Set rollback only in current thread context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadLocalEntityManagerServiceImpl

public ThreadLocalEntityManagerServiceImpl()
Method Detail

setEntityManagerFactory

public void setEntityManagerFactory(java.lang.String factoryName)
Description copied from interface: ThreadLocalEntityManagerService
Set an entity manager factory of current thread context

Specified by:
setEntityManagerFactory in interface ThreadLocalEntityManagerService
Parameters:
factoryName - the alias for entity manager factory

getEntityManager

public javax.persistence.EntityManager getEntityManager()
Description copied from interface: ThreadLocalEntityManagerService
Get the entity manager for current thread context

Specified by:
getEntityManager in interface ThreadLocalEntityManagerService
Returns:
an opened entity manager

beginTransaction

public void beginTransaction()
Description copied from interface: ThreadLocalEntityManagerService
Begin transaction in current thread context

Specified by:
beginTransaction in interface ThreadLocalEntityManagerService

beginTransaction

public void beginTransaction(boolean failOnActiveTransaction)
Description copied from interface: ThreadLocalEntityManagerService
Begin transaction in current thread context, but throw exception if transaction is already active.

Specified by:
beginTransaction in interface ThreadLocalEntityManagerService
Parameters:
failOnActiveTransaction - true if you want to stop when transaction is already active

commitTransaction

public void commitTransaction()
Description copied from interface: ThreadLocalEntityManagerService
Commit transaction in current thread context

Specified by:
commitTransaction in interface ThreadLocalEntityManagerService

rollbackTransaction

public void rollbackTransaction()
Description copied from interface: ThreadLocalEntityManagerService
Rollback transaction in current thread context

Specified by:
rollbackTransaction in interface ThreadLocalEntityManagerService

setRollbackOnlyTransaction

public void setRollbackOnlyTransaction()
Description copied from interface: ThreadLocalEntityManagerService
Set rollback only in current thread context

Specified by:
setRollbackOnlyTransaction in interface ThreadLocalEntityManagerService

closeEntityManager

public void closeEntityManager()
Description copied from interface: ThreadLocalEntityManagerService
Close entity manager in current thread context

Specified by:
closeEntityManager in interface ThreadLocalEntityManagerService


Copyright © 2008-2009 Kraken Project. All Rights Reserved.