Class FlushClearCache

java.lang.Object
org.eclipse.persistence.config.FlushClearCache

public class FlushClearCache extends Object
FlushClearCache persistence property defines modes of cache handling after em.flush call followed by em.clear call. This property could be specified while creating either EntityManagerFactory (createEntityManagerFactory or persistence.xml) or EntityManager (createEntityManager); the latter overrides the former.

JPA persistence property Usage:

properties.add(PersistenceUnitProperties.FLUSH_CLEAR_CACHE, FlushClearCache.Drop);

Values are case-insensitive. "" could be used instead of default value FlushClearCache.DEFAULT.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
    Call to clear method causes to drop the whole EntityManager cache.
    static final String
    Call to clear method causes to drops the whole EntityManager cache, on commit the classes that have at least one object updated or deleted are invalidated in the shared cache.
    static final String
    Call to clear method causes to drop from EntityManager cache only the objects that haven't been flushed.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
    This constructor will be marked private and the class final.
  • Method Summary

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • Merge

      public static final String Merge
      Call to clear method causes to drop from EntityManager cache only the objects that haven't been flushed. This is the most accurate mode: shared cache is perfect after commit; but the least memory effective: smbd repeatedly using flush followed by clear may eventually run out of memory in a huge transaction.
      See Also:
    • Drop

      public static final String Drop
      Call to clear method causes to drop the whole EntityManager cache. This is the fasteset and using the least memory mode - but after commit the shared cache potentially contains stale data.
      See Also:
    • DropInvalidate

      public static final String DropInvalidate
      Call to clear method causes to drops the whole EntityManager cache, on commit the classes that have at least one object updated or deleted are invalidated in the shared cache. This is a compromise mode: potentially a bit slower than drop, but has virtually the same memory efficiency. After commit all potentially stale data is invalidated in the shared cache.
      See Also:
    • DEFAULT

      public static final String DEFAULT
      See Also:
  • Constructor Details

    • FlushClearCache

      @Deprecated(since="4.0.3", forRemoval=true) public FlushClearCache()
      Deprecated, for removal: This API element is subject to removal in a future version.
      This constructor will be marked private and the class final. It is not designed for extensibility.