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()andVERSION()functions,CAST,LEFT,RIGHT,REPLACE, the||operator,UNION/INTERSECT/EXCEPT [ALL],NULLS FIRST/LAST,TREATin joins and paths,JOIN … ON,EXTRACT,LOCAL DATE/TIME/DATETIME, additional math functions, an optionalSELECTclause and the implicitthisidentification variable (bound automatically when aFROMitem declares no identification variable). See Typecasts. As defined by the specification grammar,ID()andVERSION()may only be compared with=or<>; other operators are rejected with a parse error. In-memory query execution (and customStoreQueryimplementations) honoursNULLS FIRST/LASTand rejectsUNION/INTERSECT/EXCEPT;LEFT/RIGHTandCASTare not available on Derby. Derby has noEXTRACT, 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()andrefresh()withFindOption/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 inorg.apache.openjpa.persistence.PersistenceException),getSchemaManager(),getName(),getTransactionType(),getNamedEntityGraphs();PersistenceUnitUtil:getVersion(),isInstance(),getClass(),load(); programmatic bootstrap viaPersistence.createEntityManagerFactory(PersistenceConfiguration)and thejakarta.persistence.dataSourceproperty.EntityManager.find(EntityGraph, …),createQuery(TypedQueryReference),getNamedQueries()andSynchronizationType.UNSYNCHRONIZEDare not yet implemented. -
Entity graphs (
@NamedEntityGraph,createEntityGraph(),getEntityGraph()),CriteriaUpdate,CriteriaDelete,CriteriaSelectset operations,Join.on(),CriteriaBuilder.cast()/left()/right()/replace()/extract()andtreat(Root), all of which previously threwUnsupportedOperationException. -
Mapping: Java records as
@Embeddable(records are always treated as managed types, regardless ofopenjpa.RuntimeUnenhancedClasses),@EnumeratedValue(an enum declaring such a field changes its stored representation),@Versiononjava.time.Instantandjava.time.LocalDateTime(give such columns at least microsecond precision),@Column(secondPrecision, options),@Table(options), repeatable@SequenceGenerator/@TableGenerator,ConstructorResultin result set mappings, inline result mappings on@NamedNativeQuery,orm.xmlversion 3.2, id classes without a public no-argument constructor, and@MapsIdwith non-embeddable id classes. -
jakarta.persistence.ForeignKey,@Indexsort order,@JoinTable.indexesand@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.