Notable new features

The following Jakarta Persistence 3.2 features are new in this release. They are opt-in and do not change existing behavior unless noted:

  • JPQL: ID() and VERSION() functions, CAST, LEFT, RIGHT, REPLACE, the || operator, UNION/INTERSECT/EXCEPT [ALL], NULLS FIRST/LAST, TREAT in joins and paths, JOIN …​ ON, EXTRACT, LOCAL DATE/TIME/DATETIME, additional math functions, an optional SELECT clause and the implicit this identification variable (bound automatically when a FROM item declares no identification variable). See Typecasts. As defined by the specification grammar, ID() and VERSION() may only be compared with = or <>; other operators are rejected with a parse error. In-memory query execution (and custom StoreQuery implementations) honours NULLS FIRST/LAST and rejects UNION/INTERSECT/EXCEPT; LEFT/RIGHT and CAST are not available on Derby. Derby has no EXTRACT, so OpenJPA renders it with Derby’s date and time functions; EXTRACT(WEEK), for which Derby has no function, is computed from the year, month and day of the date as the ISO-8601 week.

  • EntityManager: find(), lock() and refresh() with FindOption/LockOption/RefreshOption, getReference(entity), cache mode and timeout accessors, runWithConnection()/callWithConnection(), createQuery(CriteriaSelect); Query: getSingleResultOrNull(), cache mode and timeout setters.

  • EntityManagerFactory: runInTransaction()/callInTransaction() (exceptions are rethrown wrapped in org.apache.openjpa.persistence.PersistenceException), getSchemaManager(), getName(), getTransactionType(), getNamedEntityGraphs(); PersistenceUnitUtil: getVersion(), isInstance(), getClass(), load(); programmatic bootstrap via Persistence.createEntityManagerFactory(PersistenceConfiguration) and the jakarta.persistence.dataSource property. EntityManager.find(EntityGraph, …​), createQuery(TypedQueryReference), getNamedQueries() and SynchronizationType.UNSYNCHRONIZED are not yet implemented.

  • Entity graphs (@NamedEntityGraph, createEntityGraph(), getEntityGraph()), CriteriaUpdate, CriteriaDelete, CriteriaSelect set operations, Join.on(), CriteriaBuilder.cast()/ left()/right()/replace()/ extract() and treat(Root), all of which previously threw UnsupportedOperationException.

  • Mapping: Java records as @Embeddable (records are always treated as managed types, regardless of openjpa.RuntimeUnenhancedClasses), @EnumeratedValue (an enum declaring such a field changes its stored representation), @Version on java.time.Instant and java.time.LocalDateTime (give such columns at least microsecond precision), @Column(secondPrecision, options), @Table(options), repeatable @SequenceGenerator/@TableGenerator, ConstructorResult in result set mappings, inline result mappings on @NamedNativeQuery, orm.xml version 3.2, id classes without a public no-argument constructor, and @MapsId with non-embeddable id classes.

  • jakarta.persistence.ForeignKey, @Index sort order, @JoinTable.indexes and @Converter(autoApply=true) are honored (see the respective sections above for the effect on existing schemas).

  • The bundled Jakarta Persistence schemas are now included under the Eclipse Foundation Specification License 1.1 instead of the CDDL.