Jump to: navigation, search

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

(Try them Out)
Line 2: Line 2:
  
 
This set of examples uses a common employee domain model and relational schema with various configuration approaches.
 
This set of examples uses a common employee domain model and relational schema with various configuration approaches.
 +
 
* '''Model''': JPA using standard and extended annotations along with eclipselink-orm.xml mapping file.
 
* '''Model''': JPA using standard and extended annotations along with eclipselink-orm.xml mapping file.
* '''Model No SQL''': JPA using standard and extended annotations along with eclipselink-orm.xml mapping file on a NoSql platform.
 
 
* '''Model Web''': JPA using standard and extended annotations along with eclipselink-orm.xml mapping file with a web interface.
 
* '''Model Web''': JPA using standard and extended annotations along with eclipselink-orm.xml mapping file with a web interface.
 
* '''Model Web JS''': JPA using standard and extended annotations along with eclipselink-orm.xml mapping file with a web interface.
 
* '''Model Web JS''': JPA using standard and extended annotations along with eclipselink-orm.xml mapping file with a web interface.
* '''Dynamic''': Dynamic persistence (no Java classes) mapped using API and eclipselink-orm.xml
 
  
 
== Try them Out ==
 
== Try them Out ==
Line 12: Line 11:
 
To try out these examples using GIT and Maven. The basic steps are:
 
To try out these examples using GIT and Maven. The basic steps are:
  
# Check out the code
+
=== 1. Check out the code ===
# Build and test the projects (mvn test)
+
# Deploy to your favorite web container
+
 
+
  
 
You can check the latest versions of all the example projects out of GIT from [https://github.com/eclipse/examples git.eclipse.org/gitroot/eclipselink/examples.git] or browse the source [https://github.com/eclipse/examples/tree/master/jpa/employee here].
 
You can check the latest versions of all the example projects out of GIT from [https://github.com/eclipse/examples git.eclipse.org/gitroot/eclipselink/examples.git] or browse the source [https://github.com/eclipse/examples/tree/master/jpa/employee here].
 +
 +
=== 2. Build and Test ===
 +
 +
 +
TODO
 +
 +
=== 3. Setup your Container ===
 +
 +
TODO
 +
 +
=== 4. Deploy and Try ===
 +
 +
TODO
  
 
== Understanding the Examples ==
 
== Understanding the Examples ==

Revision as of 10:08, 7 May 2013

EclipseLink JPA Employee Examples

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

  • Model: JPA using standard and extended annotations along with eclipselink-orm.xml mapping file.
  • Model Web: JPA using standard and extended annotations along with eclipselink-orm.xml mapping file with a web interface.
  • Model Web JS: JPA using standard and extended annotations along with eclipselink-orm.xml mapping file with a web interface.

Try them Out

To try out these examples using GIT and Maven. The basic steps are:

1. Check out the code

You can check the latest versions of all the example projects out of GIT from git.eclipse.org/gitroot/eclipselink/examples.git or browse the source here.

2. Build and Test

TODO

3. Setup your Container

TODO

4. Deploy and Try

TODO

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