Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EclipseLink/Development/JPA 2.0/cache usaged"
< EclipseLink | Development | JPA 2.0
(→Summary) |
|||
Line 18: | Line 18: | ||
The specification introduces cache usage controls in JPA 2.0. Users can use | The specification introduces cache usage controls in JPA 2.0. Users can use | ||
settings on the Entity and Query hints to control how the cache should be used. | settings on the Entity and Query hints to control how the cache should be used. | ||
− | + | There are separate settings for how a provider can use the cache for query | |
results and when the cache should be updated with database query results. | results and when the cache should be updated with database query results. | ||
+ | <source lang="java"> | ||
// From JPA 2.0 Specification | // From JPA 2.0 Specification | ||
public enum CacheRetrieveMode { | public enum CacheRetrieveMode { | ||
Line 59: | Line 60: | ||
REFRESH | REFRESH | ||
} | } | ||
+ | </source> | ||
+ | <source lang="java"> | ||
// From JPA 2.0 Specification | // From JPA 2.0 Specification | ||
@Target({TYPE}) @Retention(RUNTIME) | @Target({TYPE}) @Retention(RUNTIME) | ||
public @interface Cacheable { | public @interface Cacheable { | ||
boolean value() default true; | boolean value() default true; | ||
− | + | </source> | |
Most of this support should already exist at the query level but entity level | Most of this support should already exist at the query level but entity level |
Revision as of 21:17, 19 May 2009
JPA 2.0: Cache Usage Settings
Date | Committer(s) | Description |
---|---|---|
Feb 2, 2009 | gyorke | Initial feature template |
Summary
The specification introduces cache usage controls in JPA 2.0. Users can use settings on the Entity and Query hints to control how the cache should be used. There are separate settings for how a provider can use the cache for query results and when the cache should be updated with database query results.
// From JPA 2.0 Specification public enum CacheRetrieveMode { /** * Read entity data from the cache: this is * the default behavior. */ USE, /** * Bypass the cache: get data directly from * the database. */ BYPASS } public enum CacheStoreMode { /** * Insert/update entity data into cache when read * from database and when committed into database: * this is the default behavior. Does not force refresh * of already cached items when reading from database. */ USE, /** * Don't insert into cache. */ BYPASS, /** * Insert/update entity data into cache when read * from database and when committed into database: * Forces refresh of cache for items read from database. */ REFRESH }
// From JPA 2.0 Specification @Target({TYPE}) @Retention(RUNTIME) public @interface Cacheable { boolean value() default true;
Most of this support should already exist at the query level but entity level settings may need to be added. PersistenceUnitInfo class updates. orm.xml and persistence.xml processing and annotation processing will be required
Functional Requirements
- Support specification requirements.
- Default for the "caching element" will be DISABLE_SELECTIVE
Work Estimate
- Develop model for testing cache usage settings
- approx 3 days
- Update processing
- approx 3 days
- Implement Functionality
- approx 3 days