Definition

Dynamic Persistence is defined as the ability to create a dynamic persistent entity and use it within an application without a-priori the entity's Java .class being present on the classpath (or in some .jar/.war archive).

The purpose of Dynamic Persistence is to enable simplified data access where only mapping information is required and no concrete Java model is required. This allows applications with dynamic storage requirements to avoid coupling to static classes or require specialized handling of new types. The application uses standard EclipseLink APIs to read, create, modify, and remove dynamic persistent entities from their data stores based on types that are either defined in XML mapping files or are constructed within the running application.

Configuration

Static Configuration

A static configuration defines the dynamic persistent entity's structure and mappings in XML packaged with the application. This is used when the
entity is generated before/during deployment and no runtime alteration of its structure is required.

Dynamic Configuration

A dynamic configuration defines the dynamic persistent entity's structure and mappings at runtime, as part of the running application.

Functional Requirements

JPA (ORM)

Support for defining dynamic types using deployment XML (with or without sessions.xml) with EclipseLink native ORM API

Support for defining dynamic types using deployment XML with sessions.xml with EclipseLink JPA using PU properties to specify sessions.xml location and session name

Support for defining dynamic entities at runtime for use with EclipseLink native ORM API

Support for defining dynamic entities at runtime for use with EclipseLink JPA

Support for removal of a dynamic type - removing the descriptor and any entity caching

Support for heterogeneous models where some entity types are persistent and some are dynamic including relationships between these

Mappings Supported

Basic/DirectToField

Relationships: 1:1, 1:M, M:M, Basic/DirectCollection

Multi-table and composite PK

Single table and Joined inheritance

Schema Creation

Support for creation of new tables - requires a non JTA JDBC connection

Extension/Customization of Dynamic Persistence capabilities

DBWS uses dynamic entities in a 'static' configuration, i.e. once the Web service is deployed and initialized, no new properties can be introduced. In addition, the public DynamicEntity API will never be exposed. With these simpler/different requirements, ensure

DBWS can function within the Dynamic Persistence framework as well as use DBWS-specific custom classes.

Limitations

The following are the limitations of the initial EclipseLink Dynamic Persistence capabilities:

JPA/ORM Configuration

Support will NOT be available for usage of JPA's orm.xml or eclipselink-orm.xml. This will require the attribute-classification to be added to the eclipselink-orm XSD and the metadata processing to support trusting this classification instead of accessing the attribute type from the entity class.

There will be NO support for dynamic entity types having any static state (I.e. Hybrid classes). This means you cannot have a static class with additional dynamic attributes or a static entity superclass or mapped superclass

Mapping Limitations

EmbeddedId, Maps

Relationship management

Dynamic Type Storage: This solution supports the usage of entity types defined at runtime but does not store or share these definitions across multiple application instances or executions of the application. It is the responsibility of the application to maintain theior definitions and create them using the provided API when required.

MOXy (planned for future (2.0?) release)

Support for defining dynamic types using deployment XML with sessions.xml to create a native XML Context

Support for defining dynamic types using deployment XML with sessions.xml to create a JAXB Context

JPA/ORM with MOXy (planned for future (2.0?) release)

Support all of the JPA/ORM c0nfiguration options above with additional support for native/JAXB MOXy mappings of the same dynamic entities

The MOXy mappings are limited to be a subset of the JPA/ORM mappings

DBWS (planned for future (2.0?) release)

Upgrade the DBWS runtime to use the common DynamicClassLoader and DynamicClassWriter

If possible share a common base class and support for MOXy with JPA

SDO (planned for future (2.0?) release)

Upgrade the SDO runtime for dynamic data objects to use the common DynamicClassLoader and DynamicClassWriter

SDO will require its own base class with a pluggable value-store as well as an extended DynamicClassWriter to handle the additional interfaces necessary

Design

The design of this new public functionality of EclipseLink is based on existing solutions consumers have used. These existing customers include Oracle BPEL/ESB, EclipseLink DBWS, and EclipseLink SDO. The design of this feature is divided into several pieces each described on their own page: