Jump to: navigation, search

Difference between revisions of "EclipseLink/Examples/Foundation/DynamicPersistence"

Line 1: Line 1:
 +
__NOTOC__
 +
<css>
 +
  .source-java5 {padding:4px;border:1px solid black;}
 +
  .source-xml {padding:4px;border:1px solid black;}
 +
</css>
 
== Simple Example using EclipseLink Dynamic Persistence ==
 
== Simple Example using EclipseLink Dynamic Persistence ==
  

Revision as of 14:39, 16 December 2009


Simple Example using EclipseLink Dynamic Persistence

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.

Example

The classes from the new package org.eclipse.persistence.dynamic are used to construct a simple persistence example: DynamicClassLoader, DynamicHelper, and DynamicTypeBuilder:

DynamicClassLoader dcl = new DynamicClassLoader(parentClassLoader);