Skip to content

An example showing how to set up and test JPA classes.

License

Notifications You must be signed in to change notification settings

Bernardo-MG/jpa-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JPA Example

An example showing how to set up and test JPA classes.

Release docs Development docs

Release javadocs Development javadocs

Features

The project offers examples showing how to set up and test JPA classes, covering the following cases:

  • Collection and map fields
  • Converters
  • Date, time and timestamp fields
  • Embedded objects
  • Enumeration fields
  • Inheritance schemes (discriminator, table per class, joined, mapped super class)
  • Id fields (class id, composite, embeddable composite)
  • Large object fields
  • Relationships (many to many, many to one, one to one)
  • Sequences (auto generated, generated identity, sequence, table)
  • Secondary table

Documentation

Documentation is always generated for the latest release, kept in the 'master' branch:

Documentation is also generated from the latest snapshot, taken from the 'develop' branch:

The documentation site sources come along the source code (as it is a Maven site), so it is always possible to generate them using the following Maven command:

mvn verify site -P h2,eclipselink

The verify phase is required, as otherwise some of the reports won't be created.

Usage

The application is coded in Java, using Maven to manage the project.

Profiles

Maven profiles are included for setting up the database and JPA provider.

Profile Database
h2 H2 in-memory database
hsqldb HSQLDB in-memory database
mysql MySQL database
postgres PostgreSQL database
Profile Provider
hibernate Hibernate
eclipselink Eclipselink

Running the tests

The project requires a database and a JPA provider for being able to run the integration tests:

mvn verify -P h2,eclipselink

Missing JPA metadata

Currently there are some problems when generating the JPA metadata classes automatically. Mainly that they are not generated when trying to refresh the Maven project on Eclipse.

To fix this just package the project:

mvn package

Collaborate

Any kind of help with the project will be well received, and there are two main ways to give such help:

  • Reporting errors and asking for extensions through the issues management
  • or forking the repository and extending the project

Issues management

Issues are managed at the GitHub project issues tracker, where any Github user may report bugs or ask for new features.

Getting the code

If you wish to fork or modify the code, visit the GitHub project page, where the latest versions are always kept. Check the 'master' branch for the latest release, and the 'develop' for the current, and stable, development version.

License

The project has been released under the MIT License.