Creating a JPA project with EclipseLink and Maven

How to create a JPA project in Eclipse with EclipseLink library using Maven. EclipseLink is JPA 2.0 implementation. Presented on MySQL database.

If you want to use EclipseLink with Maven, do the following:

Create a new Maven project and skip archetype selection. Google "eclipselink maven" and there you will find that you need eclipselink library and javax.persistence library. Add Eclipselink repository. Add following dependencies: eclipselink, javax.persistence and your JDBC driver.

Select project properties, Project Facets, choose JPA and edit JPA configuration: Select your EclipseLink version, disable library configuration and select your database connection in Eclipse. This will create META-INF/persistence.xml file. Goto Connection tab, choose transaction type "Resource Local" and populate configuration from your Eclipse connection.

Now you have your project fully configured for work with JPA.