nl.knowledgeplaza.util.jpa
Class EntityManagerExtender

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

public class EntityManagerExtender
extends java.lang.Object
implements java.lang.reflect.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 java.lang.Object CLEARED_ENTITIES
           
static java.lang.String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Constructor Summary
protected EntityManagerExtender(javax.persistence.EntityManager em)
           
 
Method Summary
 void clearDelayedActions()
           
static void executeNextClearWithoutClearingRemovedEntities(javax.persistence.EntityManager entityManager)
           
 java.util.List<EntityManagerExtender.Action> getDelayedActions()
          DelatedActions
 javax.persistence.EntityManager getEntityManager()
          EntityManager
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.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 java.lang.String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values

CLEARED_ENTITIES

public static final java.lang.Object CLEARED_ENTITIES
Constructor Detail

EntityManagerExtender

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

getEntityManager

public javax.persistence.EntityManager getEntityManager()
EntityManager


getDelayedActions

public java.util.List<EntityManagerExtender.Action> getDelayedActions()
DelatedActions


clearDelayedActions

public void clearDelayedActions()

invoke

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

wrap

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

executeNextClearWithoutClearingRemovedEntities

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


Copyright © 2010. All Rights Reserved.