New features, enhancements or additions
- Adds support for Java record types as embeddable classes
- Adds support for
java.time.Instantandjava.time.Yearand Clarifies JDBC mappings for basic types - Adds
union,intersect,except,cast,left,right, andreplacefor Jakarta Persistence QL and criteria queries - Adds
||string concatenation operator andidandversionfunctions to Jakarta Persistence QL - Adds
CriteriaSelect,subquery(EntityType)and joins onEntityTypeto Criteria API - Adds support for specifying null precedence when ordering Jakarta Persistence QL and criteria queries
- Adds
getSingleResultOrNull()toQuery,TypedQuery,StoredProcedureQuery - Adds
entities(),classes()andcolumns()toNamedNativeQuery - Adds
lockMode()toEntityResultwith the default beingOPTIMISTIC - Adds
getVersion(),isLoaded(),load(),isInstance()andgetClass()methods toPersistenceUnitUtil - Adds overload of
entity()accepting an entity name toMetamodel - Adds
javax.annotation.processing.Generatedto the list of defined annotations onStaticMetamodel - Adds constants for managed types, named queries, named graphs and named result set mappings to generated
StaticMetamodel - Adds
LocalDateTimeandInstantto supportedVersiontypes - Adds
where(),having(),and(), andor()overloads acceptingListtoCriteriaQueryandCriteriaBuilder - Adds
equalTo()andnotEqualTo()toExpression - Adds
concat()overload accepting list of expressions andextract()toCriteriaBuilder - Adds
Graphinterface as parent ofEntityGraphandSubgraphand moved common operations there - Adds
addAttributeNode(),removeAttributeNode(),addTreatedSubgraph(),addElementSubgraph(),addTreatedElementSubgraph(),addMapKeySubgraph(), andaddTreatedMapKeySubgraph()methods toGraph - Adds
getReferenceoverload,runWithConnection()andcallWithConnection()toEntityManager - Adds
find(),refresh(),lock()overloads toEntityManagertaking newly introducedFindOption,RefreshOption, andLockOptionrespectively - Adds
setCacheStoreMode(), andsetCacheRetrieveMode()methods toEntityManagerandQuery - Adds
runInTransaction()andcallInTransaction()toEntityManagerFactory - Adds
getName()toEntityManagerFactory - Adds programmatic API to obtain
EntityManagerFactoryusingPersistenceConfiguration - Adds constants for properties defined by the specification to the
PersistenceConfiguration - Adds
SchemaManagerAPI - Adds options member to elements which result in DDL generation
- Adds
EnumeratedValueallowing custom mapping of fields of Java enums - Adds
commentandcheckmembers to table and column annotations, along withCheckConstraint - Allows scalar expressions in the
ORDER BYclause in Jakarta Persistence QL - Allows usage of
TableGeneratorandSequenceGeneratorat the java package level - Makes the
namemember ofTableGeneratorandSequenceGeneratoroptional - Makes identification variables and the _SELECT_ clause in Jakarta Persistence QL optional
- Clarifies the primary key types supported for each
GenerationType - Clarifies availability of
SEQUENCE,TABLEandUUIDgenerated IDs onPrePersist - Clarifies semantics of numeric literals and Adds support for
biandbdsuffixes - Clarifies semantics of
Convert/Converterannotations - Clarifies rules around distinction of entity names and identification variables and case-sensitivity in Jakarta Persistence QL queries
- Clarifies the semantics of
Bindable.ENTITY_TYPEin javadoc - Entity and embeddable classes may now be static inner classes
- Primary key classes are no longer required to be public and serializable
- Pulls
getParameters()up fromCriteriaQuerytoCommonAbstractCriteria - Fixes wildcard types in
addSubgraphandaddAttributeNodeinGraph - Fixes lower type bounds to the
Path.getentity argumentX - Fixes example code in the javadoc of
AttributeOverrides - Partially fixes raw types warnings through the API
- Improves AsciiDoc formatting and fixes typos through the specification document
Removals, deprecations or backwards incompatible changes
Deprecations
- Deprecates usage of
Calendar,Date,Time,Timestamp,Temporal,MapKeyTemporalandTemporalTypein new applications in favour ofjava.timeAPI - Deprecates
multiselectmethods inCriteriaQuery. The preference is to usearrayortuplemethod defined inCriteriaBuilder
Deprecations for removal
- Deprecates
addSubclassSubgraph()inEntityGraphfor removal;addTreatedSubgraph()method should be used as direct replacement - Deprecates
addSubgraph(Attribute, Class)andaddKeySubgraph()inGraph/EntityGraph/SubGraphfor removal;addTreatedSubgraph(Attribute, Class)andaddMapKeySubgraph()methods should be used as direct replacements - Deprecates
jakarta.persistence.spi.PersistenceUnitTransactionTypefor removal;jakarta.persistence.PersistenceUnitTransactionTypemethods should be used as direct replacement - Deprecates default public no-arg constructor in
jakarta.persistence.PersistenceandPERSISTENCE_PROVIDERandprovidersfields in this class for removal with no replacement. This class is not designed for extensibility
Minimum Java SE Version
Java SE 17 or higher