What is the use of CoordinationType in JPA?

I am new to JPA, I started JPA applications. At runtime, I discovered

@Cache(coordinationType=CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS)

And more types in coordination. I did not support the use of CoordinationType in JPA. Can someone tell me about this, when to use and what type of coordination to use.

+4
source share
2 answers

JPA 2.0 : - . JPA 1.0 . , . JPA 2.0 , . , , . CacheCoordinationType eclipselink . , , API- JPA. . , , , . :

  • .
  • , . , .
+5

CacheCoordinationType javadoc:

/** 
 * An enum that is used within the Cache annotation.
 * 
 * @see org.eclipse.persistence.annotations.Cache
 * @author Guy Pelletier
 * @since Oracle TopLink 11.1.1.0.0 
 */ 
public enum CacheCoordinationType {
    /**
     * Sends a list of changed objects including data about the changes. 
     * This data is merged into the receiving cache.
     */
    SEND_OBJECT_CHANGES,

    /**
     * Sends a list of the identities of the objects that have changed. The 
     * receiving cache invalidates the objects (rather than changing any of the 
     * data)
     */
    INVALIDATE_CHANGED_OBJECTS,

    /**
     * Same as SEND_OBJECT_CHANGES except it also includes any newly created 
     * objects from the transaction.
     */
    SEND_NEW_OBJECTS_WITH_CHANGES,

    /**
     * Does no cache coordination.
     */
    NONE
}

, : @ 2-10 @Cache https://eclipse.org/eclipselink/documentation/2.4/jpa/extensions/a_cache.htm

# 3 - http://java-persistence-performance.blogspot.com/2011/06/how-to-improve-jpa-performance-by-1825.html

0

Source: https://habr.com/ru/post/1526114/


All Articles