EclipseLink is reference implementation for the Java Persistence API (JPA) specification. This project is maintained and supported by the Eclipse Open Source foundation. EclipseLink not only supports the JPA standards, it also supports the following open source standards:
- Java Persistence API (JPA)
- Java Architecture for XML Binding (JAXB)
- Java Connector Architecture (JCA)
- Service Data Objects (SDO)
EclipseLink is originated from the TopLink, a popular ORM framework which Oracle has created and maintained for its products. EclipseLink project has been supported by Oracle itself to create own source code from the TopLink project. At the time of releasing the JPA 2.0 specification, Sun has chosen EclipseLink as the Reference Implementation (RI) for JPA 2.0 standards.
The latest version released for eclipselink is 2.5..
This post publishes the useful eclipselink tutorials related to the latest EclipseLink implementation. We maintain this page up-to-date with the latest tutorials.
EclipseLink Configuration and Setup
- Eclipse Link – JPA Installation & Configuration : This article should teach you how can do you install and use the EclipseLink-JPA. The Integrated Development Environment that will be used in this installation guide is “Eclipse Java EE IDE for Web Developers- Kepler Service Release 1”.
- How To Create EclipseLink Project Using Maven Archetype : This article should discuss the installation and configuration of EclipseLink-JPA using Maven dependencies and Maven archetype project creation principle. This article assumes that the machine that used for installation is already have installed a Maven. So the “mvn” command should works. This article will use an Eclipse Kepler release 1 as an Integrated Development Environment
- EclipseLink – JPA Annotations : This tutorial is the summary of all the annotations related to EclipseLink and JPA frameworks. This also links to the suitable annotation tutorials as appropriate.
- JPA Fields Annotations – @Basic and @Transient : This tutorials explains the usage of two key field level annotation @Basic and @Transient with the simple example.
- @OneToOne : OneToOne annotation is one of the annotations that are used for defining a single-valued association to another entity that has one-to-one multiplicity. The multiplicity concept seems ambiguous but it simply tells you the maximum and minimum allowed members of the set. It is a UML design concept for defining the association relationship, in one-to-one case
@OneToMany and @ManyToOne : The OneToMany and ManyToOne annotations are two major JPA annotations that are used for defining two different kinds of associations. The OneToMany annotation define a many-valued association with one-to-many multiplicity, whereas the ManyToOne annotation defines a single-valued association to another entity that has many-to-one multiplicity.
- @ManyToMany : The Many-To-Many annotation is one of the most important annotations provided by the EclipseLink – JPA. It defines a many-valued association with ManyToMany multiplicity (See single-valued multiplicity and different kind of many-valued multiplicity). A newly concept has introduced such as (JoinTable) as well as a new annotation like (@JoinTable) when we are coming.
@Inheritance With Single Table Strategy : In the Java Persistence API (JPA) The entities support inheritance, polymorphic, polymorphic associations, and polymorphic queries. Both abstract and concrete classes can be entities, and both of them can be annotated with the @Entity annotation, mapped as entities and queried for as entities. Entities can extend non-entity classes and non-entity classes can extend entity classes.
- @Inheritance With Joined Table Strategy : In the Java Persistence API (JPA) The entities support inheritance, polymorphic, polymorphic associations, and polymorphic queries. Both abstract and concrete classes can be entities, and both of them can be annotated with the @Entity annotation, mapped as entities and queried for as entities. Entities can extend non-entity classes and non-entity classes can extend entity classes.
- @MappedSuperclass :[email protected] is not persisted itself, but the sub-classes are persistent. So, this annotation is used for an abstract class or a non-persistent class. The equivalent XML element is mapped-superclass in the persistent configuration file.
- @Inheritance With Table Per Concrete Strategy : This strategy is an optional, based on the specification “Support for the table per concrete class inheritance mapping strategy is optional”. In table per class inheritance a table is defined for each concrete class in the inheritance hierarchy to store all the attributes of that class and all of its super classes.
- @AttributeOverride And @AssociationOverride : Using @AttributeOverride and @AssociationOverride to override the attributes and associations that inherited from the mapped superclass. An entity can inherit a persistent entity state and mapping information using different annotations, one of them was using of @MappedSuperclass.
Exception and Common Issues
- EclipseLink – Configuration error. Class [com.mysql.jdbc.Driver] not found [javax.persistence.PersistenceException]
- EclipseLink – javax.persistence.PersistenceException : No Persistence provider for EntityManager
- EclipseLink / JPA – com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column