New features, enhancements or additions
- Adds support for Java record types as embeddable classes
- Adds support for
java.time.Instant
andjava.time.Year
and Clarifies JDBC mappings for basic types - Adds
union
,intersect
,except
,cast
,left
,right
, andreplace
for Jakarta Persistence QL and criteria queries - Adds
||
string concatenation operator andid
andversion
functions to Jakarta Persistence QL - Adds
CriteriaSelect
,subquery(EntityType)
and joins onEntityType
to 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()
toEntityResult
with the default beingOPTIMISTIC
- Adds
getVersion()
,isLoaded()
,load()
,isInstance()
andgetClass()
methods toPersistenceUnitUtil
- Adds overload of
entity()
accepting an entity name toMetamodel
- Adds
javax.annotation.processing.Generated
to the list of defined annotations onStaticMetamodel
- Adds constants for managed types, named queries, named graphs and named result set mappings to generated
StaticMetamodel
- Adds
LocalDateTime
andInstant
to supportedVersion
types - Adds
where()
,having()
,and()
, andor()
overloads acceptingList
toCriteriaQuery
andCriteriaBuilder
- Adds
equalTo()
andnotEqualTo()
toExpression
- Adds
concat()
overload accepting list of expressions andextract()
toCriteriaBuilder
- Adds
Graph
interface as parent ofEntityGraph
andSubgraph
and moved common operations there - Adds
addAttributeNode()
,removeAttributeNode()
,addTreatedSubgraph()
,addElementSubgraph()
,addTreatedElementSubgraph()
,addMapKeySubgraph()
, andaddTreatedMapKeySubgraph()
methods toGraph
- Adds
getReference
overload,runWithConnection()
andcallWithConnection()
toEntityManager
- Adds
find()
,refresh()
,lock()
overloads toEntityManager
taking newly introducedFindOption
,RefreshOption
, andLockOption
respectively - Adds
setCacheStoreMode()
, andsetCacheRetrieveMode()
methods toEntityManager
andQuery
- Adds
runInTransaction()
andcallInTransaction()
toEntityManagerFactory
- Adds
getName()
toEntityManagerFactory
- Adds programmatic API to obtain
EntityManagerFactory
usingPersistenceConfiguration
- Adds constants for properties defined by the specification to the
PersistenceConfiguration
- Adds
SchemaManager
API - Adds options member to elements which result in DDL generation
- Adds
EnumeratedValue
allowing custom mapping of fields of Java enums - Adds
comment
andcheck
members to table and column annotations, along withCheckConstraint
- Allows scalar expressions in the
ORDER BY
clause in Jakarta Persistence QL - Allows usage of
TableGenerator
andSequenceGenerator
at the java package level - Makes the
name
member ofTableGenerator
andSequenceGenerator
optional - 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
,TABLE
andUUID
generated IDs onPrePersist
- Clarifies semantics of numeric literals and Adds support for
bi
andbd
suffixes - Clarifies semantics of
Convert
/Converter
annotations - Clarifies rules around distinction of entity names and identification variables and case-sensitivity in Jakarta Persistence QL queries
- Clarifies the semantics of
Bindable.ENTITY_TYPE
in 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 fromCriteriaQuery
toCommonAbstractCriteria
- Fixes wildcard types in
addSubgraph
andaddAttributeNode
inGraph
- Fixes lower type bounds to the
Path.get
entity 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
,MapKeyTemporal
andTemporalType
in new applications in favour ofjava.time
API - Deprecates
multiselect
methods inCriteriaQuery
. The preference is to usearray
ortuple
method defined inCriteriaBuilder
Deprecations for removal
- Deprecates
addSubclassSubgraph()
inEntityGraph
for removal;addTreatedSubgraph()
method should be used as direct replacement - Deprecates
addSubgraph(Attribute, Class)
andaddKeySubgraph()
inGraph
/EntityGraph
/SubGraph
for removal;addTreatedSubgraph(Attribute, Class)
andaddMapKeySubgraph()
methods should be used as direct replacements - Deprecates
jakarta.persistence.spi.PersistenceUnitTransactionType
for removal;jakarta.persistence.PersistenceUnitTransactionType
methods should be used as direct replacement - Deprecates default public no-arg constructor in
jakarta.persistence.Persistence
andPERSISTENCE_PROVIDER
andproviders
fields in this class for removal with no replacement. This class is not designed for extensibility
Minimum Java SE Version
Java SE 17 or higher