Drools :: Persistence :: JPA 6.2.0.CR4

org.drools.persistence.map
Class MapPersistenceContextManager

java.lang.Object
  extended by org.drools.persistence.map.MapPersistenceContextManager
All Implemented Interfaces:
PersistenceContextManager

public class MapPersistenceContextManager
extends Object
implements PersistenceContextManager


Constructor Summary
MapPersistenceContextManager(PersistenceContext persistenceContext)
           
 
Method Summary
 void beginCommandScopedEntityManager()
          This method should be called at the beginning of a CommandExecutor.execute(org.kie.api.command.Command) method, when the given CommandService instance is responsible for handling persistence.
 void clearPersistenceContext()
           
 void dispose()
          Executes the necessary actions in order to clean up and dispose of the internal fields of this instance.
 void endCommandScopedEntityManager()
          This method should only called in the Synchronization.afterCompletion(int) method.
 PersistenceContext getApplicationScopedPersistenceContext()
           
 PersistenceContext getCommandScopedPersistenceContext()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapPersistenceContextManager

public MapPersistenceContextManager(PersistenceContext persistenceContext)
Method Detail

getApplicationScopedPersistenceContext

public PersistenceContext getApplicationScopedPersistenceContext()
Specified by:
getApplicationScopedPersistenceContext in interface PersistenceContextManager
Returns:
a PersistenceContext instance containing the Application Scoped EntityManager.

getCommandScopedPersistenceContext

public PersistenceContext getCommandScopedPersistenceContext()
Specified by:
getCommandScopedPersistenceContext in interface PersistenceContextManager
Returns:
a PersistenceContext instance containing the Command Scoped EntityManager.

beginCommandScopedEntityManager

public void beginCommandScopedEntityManager()
Description copied from interface: PersistenceContextManager
This method should be called at the beginning of a CommandExecutor.execute(org.kie.api.command.Command) method, when the given CommandService instance is responsible for handling persistence. See the SingleSessionCommandService class.

The first responsibility of this method is to make sure that the Command Scoped EntityManager (CSEM) joins the ongoing transaction.

When the CSEM is internally managed, this method is also responsible for creating a new CSEM for use during execution of the Command or operation being executed by the KieSession.

Specified by:
beginCommandScopedEntityManager in interface PersistenceContextManager

endCommandScopedEntityManager

public void endCommandScopedEntityManager()
Description copied from interface: PersistenceContextManager
This method should only called in the Synchronization.afterCompletion(int) method.

It is responsible for cleaning up the Command Scoped EntityManager (CSEM) instance, but only when the CSEM is an internal one, and not one supplied (and managed) by the user.

If the CSEM is (internally) managed, then this method will take the necessary actions in order to make sure that a new CSEM can be generated at the beginning of the next operation or command on the persistent KieSession.

if the CSEM is supplied (and managed) by the user, this method will do nothing with the CSEM.

Specified by:
endCommandScopedEntityManager in interface PersistenceContextManager

dispose

public void dispose()
Description copied from interface: PersistenceContextManager
Executes the necessary actions in order to clean up and dispose of the internal fields of this instance.

Specified by:
dispose in interface PersistenceContextManager

clearPersistenceContext

public void clearPersistenceContext()

Drools :: Persistence :: JPA 6.2.0.CR4

Copyright © 2001-2015 JBoss by Red Hat. All Rights Reserved.