The EclipseLink metadata is the bridge between the development of an application and its deployed run-time environment. Capture the metadata using the following:
Annotations, persistence.xml
, orm.xml
, eclipselink-orm.xml
, eclipselink-oxm.xml
, and annotation and persistence.xml
property extensions. The persistence provider interprets all these sources of metadata to create an in-memory session and project at run time.
Java and the EclipseLink API (this approach is the most labor-intensive).
The metadata lets you pass configuration information into the run-time environment. The run-time environment uses the information in conjunction with the persistent classes (Java objects or entities) and the code written with the EclipseLink API, to complete the application.
For more information, see "Overriding and Merging" in Java Persistence API (JPA) Extensions Reference for EclipseLink.
This section describes the following:
The EclipseLink metadata architecture provides many important benefits, including the following:
Stores mapping information in XML—not in the domain model objects
By using the metadata, EclipseLink does not intrude in the object model or the database schema
Allows you to design the object model as needed, without forcing any specific design
Allows DBAs to design the database as needed, without forcing any specific design
Does not rely on code-generation (which can cause serious design, implementation, and maintenance issues)
Is unobtrusive: adapts to the object model and database schema, rather than requiring you to design their object model or database schema to suit EclipseLink
Using EclipseLink JPA, you have the flexibility of expressing persistence metadata using standard JPA annotations, deployment XML, or both and you can optionally take advantage of EclipseLink JPA annotation and persistence.xml
property extensions.
A project contains the mapping metadata that the EclipseLink runtime uses to map objects to a data source. The project is the primary object used by the EclipseLink runtime.
This section describes the principal contents of project metadata, including the following:
For Object-relational mapping, the EclipseLink runtime constructs an in-memory project based on any combination of JPA annotations, persistence.xml
, orm.xml
, and EclipseLink JPA annotation and persistence.xml
property extensions.
For Object-XML mapping, the EclipseLink runtime uses a combination of JAXB annotations and eclipselink-oxm
bindings. See "Overriding and Merging" in Java Persistence API (JPA) Extensions Reference for EclipseLink.
EclipseLink maps persistent entities to the database in the application, using the descriptors and mappings you build with JDeveloper. These tools support several approaches to project development, including the following:
Importing classes and tables for mapping
Importing classes and generating tables and mappings
Importing tables and generating classes and mappings
Creating both class and table definitions
The most common solution is to develop the persistent entities using a development tool, such as a modeling tool or an integrated development environment (IDE) like JDeveloper, and to develop the relational model through appropriate relational design tools. You then use JDeveloper to construct mappings that relate these two models.
Although JDeveloper offers the ability to generate persistent entities or the relational model components for an application, these utilities are intended only to assist in rapid initial development strategies–not complete round-trip application development.
For more information, see Chapter 6, "Understanding Descriptors" and Chapter 7, "Understanding Mappings".
For POJO projects, you configure a session login in the session metadata that specifies the information required to access the data source.
For more information, see Creating Session Metadata.
A EclipseLink session contains the information required to access the data source. The session is the primary object used by your application to access the features of the EclipseLink runtime.
Using EclipseLink JPA, the EclipseLink runtime constructs an in-memory session based on any combination of JPA annotations, persistence.xml
, orm.xml
, and EclipseLink JPA annotation and persistence.xml
property extensions. The use of a sessions.xml
file is optional. See "Overriding and Merging" in Java Persistence API (JPA) Extensions Reference for EclipseLink.