Jump to: navigation, search

EclipseLink/DesignDocs/371950

EclipseLink Metadata Cache

Purpose

This feature is to look at caching the metadata project so that the setup can avoid costs associated with reading in multiple orm.xml and annotation processing on entities within a persistence unit to rebuild it unnecessarily.

Requirements

  1. EntityManagerFactory and EntityManager instance creation use properties that allow overriding metadata settings/properties the same as it would if project caching was not used
  2. Project caching must allow weaving to happen
  3. It must be configurable to allow alternate implementations to cache the project differently
  4. The project will be read from/writen to the cache prior to login, prior to converting String ClassNames into Classes.

Design

PersistenceUnitProperties

public static final String PROJECT_CACHE_ACCESSOR = "eclipselink.project-cache-accessor"; will be the base property to configure this feature, and will take a string value representing shipped implementations or the a <package.class> name of a subclass implementation of the ProjectCache interface. By default a project cache accessor will not be used.

The "eclipselink.project-cache-accessor.<implementationShortName>" subset of properties will be used for implementation specific properties.

Interface

public interface ProjectCacheAccessor {
  public Project retrieveProject(Properties properties, Classloader loader);
  public void storeProject(Project project, Properties properties);
}

Included Implementation

This feature will include a ProjectCacheAccessor implementation that uses java serialization to read to/write from a file which can be used by specifying the PROJECT_CACHE_ACCESSOR property with a value of "java-serialization" This implementation will also require the file location be specified, and will rely on a "eclipselink.project-cache-accessor.java-serialization.file" property being defined.