nl.knowledgeplaza.util.jpa
Class EntityManagerExtender

java.lang.Object
  extended by nl.knowledgeplaza.util.jpa.EntityManagerExtender
All Implemented Interfaces:
InvocationHandler
Direct Known Subclasses:
EclipselinkEntityManagerExtender

public class EntityManagerExtender
extends Object
implements InvocationHandler

The disconnected usage of the EM requires that prior to storing or removing the toplevel entity a clear must be called, then the toplevel entity is stored/removed and is propogated down. In order to propogate down, any entity must be reachable. This works fine for storing, however removed entities are not reachable anymore and the clear has cleared the EM's list of removed entities. Because of this, removed subentities are in fact not removed, but where cleared by the clear call. To work around this, this wrapper was created: 1. keep a separate administration of removed enitit

Author:
toeu

Nested Class Summary
 class EntityManagerExtender.Action
           
static interface EntityManagerExtender.EventListener
           
static class EntityManagerExtender.EventListenerImpl
           
 
Field Summary
static Object CLEAR_DELAYED_ACTIONS
           
static Object EXECUTE_DELAYED_ACTIONS
           
static Object EXECUTE_DELAYED_MERGE_ACTIONS
           
static Object EXECUTE_DELAYED_PERSIST_ACTIONS
           
static Object EXECUTE_DELAYED_REMOVE_ACTIONS
           
static Object NO_CLEAR_DELAYED_ACTIONS
           
static String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Constructor Summary
protected EntityManagerExtender(javax.persistence.EntityManager em)
           
 
Method Summary
 void clearDelayedActions()
           
 void clearDelayedActionsHashcode()
           
static void clearDelayedPersistActions(javax.persistence.EntityManager entityManager)
           
static void clearWithoutClearingDelayedActions(javax.persistence.EntityManager entityManager)
           
 void executeDelayedActions()
           
static void executeDelayedActions(javax.persistence.EntityManager entityManager)
           
 void executeDelayedMergeActions()
           
static void executeDelayedMergeActions(javax.persistence.EntityManager entityManager)
           
 void executeDelayedPersistActions()
           
static void executeDelayedPersistActions(javax.persistence.EntityManager entityManager)
           
 void executeDelayedRemoveActions()
           
static void executeDelayedRemoveActions(javax.persistence.EntityManager entityManager)
           
static void executeNextClearWithoutClearingDelayedActions(javax.persistence.EntityManager entityManager)
           
static void executeNextClearWithoutClearingRemovedEntities(javax.persistence.EntityManager entityManager)
          Deprecated.  
 List<EntityManagerExtender.Action> getDelayedActions()
          DelatedActions
 javax.persistence.EntityManager getEntityManager()
          EntityManager
 Object invoke(Object proxy, Method method, Object[] args)
           
static javax.persistence.EntityManager wrap(javax.persistence.EntityManager em)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCECODE_VERSION

public static final String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values

NO_CLEAR_DELAYED_ACTIONS

public static final Object NO_CLEAR_DELAYED_ACTIONS

CLEAR_DELAYED_ACTIONS

public static final Object CLEAR_DELAYED_ACTIONS

EXECUTE_DELAYED_ACTIONS

public static final Object EXECUTE_DELAYED_ACTIONS

EXECUTE_DELAYED_PERSIST_ACTIONS

public static final Object EXECUTE_DELAYED_PERSIST_ACTIONS

EXECUTE_DELAYED_MERGE_ACTIONS

public static final Object EXECUTE_DELAYED_MERGE_ACTIONS

EXECUTE_DELAYED_REMOVE_ACTIONS

public static final Object EXECUTE_DELAYED_REMOVE_ACTIONS
Constructor Detail

EntityManagerExtender

protected EntityManagerExtender(javax.persistence.EntityManager em)
Method Detail

getEntityManager

public javax.persistence.EntityManager getEntityManager()
EntityManager


getDelayedActions

public List<EntityManagerExtender.Action> getDelayedActions()
DelatedActions


clearDelayedActions

public void clearDelayedActions()

clearDelayedActionsHashcode

public void clearDelayedActionsHashcode()

executeDelayedActions

public void executeDelayedActions()

executeDelayedPersistActions

public void executeDelayedPersistActions()

executeDelayedMergeActions

public void executeDelayedMergeActions()

executeDelayedRemoveActions

public void executeDelayedRemoveActions()

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Specified by:
invoke in interface InvocationHandler
Throws:
Throwable

wrap

public static javax.persistence.EntityManager wrap(javax.persistence.EntityManager em)

executeNextClearWithoutClearingDelayedActions

public static void executeNextClearWithoutClearingDelayedActions(javax.persistence.EntityManager entityManager)

clearWithoutClearingDelayedActions

public static void clearWithoutClearingDelayedActions(javax.persistence.EntityManager entityManager)

executeNextClearWithoutClearingRemovedEntities

public static void executeNextClearWithoutClearingRemovedEntities(javax.persistence.EntityManager entityManager)
Deprecated. 


executeDelayedActions

public static void executeDelayedActions(javax.persistence.EntityManager entityManager)

clearDelayedPersistActions

public static void clearDelayedPersistActions(javax.persistence.EntityManager entityManager)

executeDelayedPersistActions

public static void executeDelayedPersistActions(javax.persistence.EntityManager entityManager)

executeDelayedMergeActions

public static void executeDelayedMergeActions(javax.persistence.EntityManager entityManager)

executeDelayedRemoveActions

public static void executeDelayedRemoveActions(javax.persistence.EntityManager entityManager)


Copyright © 2011 KnowledgePlaza. All Rights Reserved.