Skip to main content

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.

Jump to: navigation, search

Difference between revisions of "EclipseLink/Examples/JPA/Employee"

(Try them Out)
(Try them Out)
Line 8: Line 8:
 
== Try them Out ==
 
== Try them Out ==
  
 +
To try out these examples you can download from the project's Subversion (SVN) repository or you can download the packaged projects.
  
=== Subversion ===
+
=== Subversion (SVN)  ===
  
You can check the projects out of SVN from dev.eclipse.org:
+
You can check the 2.1 versionsof the example projects out of SVN from dev.eclipse.org:
  
 
* [http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/branches/2.1/trunk/examples/jpa.employee/ /svnroot/rt/org.eclipse.persistence/branches/2.1/trunk/examples/jpa.employee/] to get all of the examples
 
* [http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/branches/2.1/trunk/examples/jpa.employee/ /svnroot/rt/org.eclipse.persistence/branches/2.1/trunk/examples/jpa.employee/] to get all of the examples
Line 17: Line 18:
 
** [http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/branches/2.1/trunk/examples/jpa.employee/eclipselink.example.jpa.employee.xml/ /svnroot/rt/org.eclipse.persistence/branches/2.1/trunk/examples/jpa.employee/eclipselink.example.jpa.employee.xml/] - XML version
 
** [http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/branches/2.1/trunk/examples/jpa.employee/eclipselink.example.jpa.employee.xml/ /svnroot/rt/org.eclipse.persistence/branches/2.1/trunk/examples/jpa.employee/eclipselink.example.jpa.employee.xml/] - XML version
 
** [http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/branches/2.1/trunk/examples/jpa.employee/eclipselink.example.jpa.employee.dynamic/ /svnroot/rt/org.eclipse.persistence/branches/2.1/trunk/examples/jpa.employee/eclipselink.example.jpa.employee.dynamic/] - dynamic version
 
** [http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/branches/2.1/trunk/examples/jpa.employee/eclipselink.example.jpa.employee.dynamic/ /svnroot/rt/org.eclipse.persistence/branches/2.1/trunk/examples/jpa.employee/eclipselink.example.jpa.employee.dynamic/] - dynamic version
 +
 +
=== Download ===
  
 
== Understanding the Examples ==
 
== Understanding the Examples ==

Revision as of 10:54, 23 June 2010

EclipseLink JPA Employee Examples

This set of examples uses a common employee domain model and relational schema with various configuration approaches.

  • Annotations: JPA using standard and extended annotations
  • XML: JPA using extended eclispelink-orm.xml mapping file
  • Dynamic: Dynamic persistence (no Java classes) mapped using API and eclispelink-orm.xml

Try them Out

To try out these examples you can download from the project's Subversion (SVN) repository or you can download the packaged projects.

Subversion (SVN)

You can check the 2.1 versionsof the example projects out of SVN from dev.eclipse.org:

Download

Understanding the Examples

Employee Model

The employee model has existed in TopLink and EclipseLink since the mid 90's. The model has evolved a little over the years based on enhancements made available in the mappings.

EclipseLink Example Employee model.png

JPA 2.0 and Extended Features

When updated for EclipseLink 2.1 several JPA 2.0 features were introduced to the model and its mappings. These include:

  • PhoneNumber now mapped using derived identifiers so its primary key of EMP_ID and PTYPE are mapped with PhoneNumber.owner and PhoneNumber.type. The previous redundant mapping of PhoneNumber.id has been removed.

While the majority of the Employee examples use pure JPA mappings several extensions offered by EclipseLink are highlgted including:

  • Employee.gender mapped to the enum Gender using a converter to store a single char code in the database instead of the full enum's name or oridinal position.

Configuration Options

  • Annotations
  • ORM XML
    • EclipseLink ORM
    • JPA ORM + EclipseLink ORM

Back to the top