JPA 2.1 Features - rafalkieras/jpa-kss GitHub Wiki

#JPA 2.1 Features

Stored procedures

New interface for controlling stored procedure execution added: StoredProcedureQuery

Attribute converters

AttributeConverter interface provides a functionality to transform an attribute between database representation and Java representation.

Two types of usage:

  • autoapply
  • explicitly on the field/property of an entity with @Convert annotation

Schema generation

  • javax.persistence.schema-generation.database.action - [none, create, drop-and-create, drop]
  • javax.persistence.schema-generation.scripts.action - [none, create, drop-and-create, drop]
  • javax.persistence.schema-generation.scripts.create-target
  • javax.persistence.schema-generation.scripts.drop-target
  • javax.persistence.sql-load-script-source

CDI support for entity listener

An entity listener class that makes use of CDI injection may also define lifecycle callback methods annotated with the PostConstruct and PreDestroy annotations. These methods will be invoked after injection has taken place and before the entity listener instance is destroyed respectively.

Programmatic named queries

It is possible to define named queries at runtime via EntityManagerFactory#addNamedQuery method.