Java Persistence/Databases

Most JPA providers will support any JDBC and SQL compliant database. Some JPA features requires database specific support.

JPA functionality that may be database specific include:

  • schema creation
  • pagination
  • pessimistic locking
  • generated ids and sequencing
  • update and delete queries
  • outer joins
  • functions
  • lobs

Depending on what database and JPA provider you use, these features may or may not work. Most JPA providers have a persistence unit property (persistence.xml) to specify the database platform the persistence unit will be accessing, and have built in support for a large set of database platforms. Some JPA providers will auto-detect the database platform, so setting the property is not required. Many JPA providers have extended support for various databases to handle different data types or handle functionality specific to the database platform.

Most JPA providers provide support for most popular databases such as, Oracle, MySQL, PostgreSQL, DB2, SQL Server.

TopLink / EclipseLink : Have extended support for most databases, see FAQ, and have extended support for the Oracle database, see FAQ. EclipseLink will auto detect the database platform so no persistence property is required, but can be set using "eclipselink.target-database".