Jakarta Persistence is the API for the management for persistence and object/relational mapping.
Interface Summary Interface Description AttributeConverter<X,Y>A class that implements this interface can be used to convert entity attribute state into database column representation and back again. AttributeNode<T>Represents an attribute node of an entity graph. CacheInterface used to interact with the second-level cache. EntityGraph<T>This type represents the root of an entity graph that will be used as a template to define the attribute nodes and boundaries of a graph of entities and entity relationships. EntityManagerInterface used to interact with the persistence context. EntityManagerFactoryInterface used to interact with the entity manager factory for the persistence unit. EntityTransactionInterface used to control transactions on resource-local entity managers. Parameter<T>Type for query parameter objects. PersistenceUnitUtilUtility interface between the application and the persistence provider managing the persistence unit. PersistenceUtilUtility interface between the application and the persistence provider(s). QueryInterface used to control query execution. StoredProcedureQueryInterface used to control stored procedure query execution. Subgraph<T>This type represents a subgraph for an attribute node that corresponds to a Managed Type. TupleInterface for extracting the elements of a query result tuple. TupleElement<X>The
TupleElementinterface defines an element that is returned in a query result tuple.
TypedQuery<X>Interface used to control the execution of typed queries.
Class Summary Class Description PersistenceBootstrap class that is used to obtain an
EntityManagerFactoryin Java SE environments.
Enum Summary Enum Description AccessTypeUsed with the
Accessannotation to specify an access type to be applied to an entity class, mapped superclass, or embeddable class, or to a specific attribute of such a class.
CacheRetrieveModeUsed as the value of the
javax.persistence.cache.retrieveModeproperty to specify the behavior when data is retrieved by the
findmethods and by queries.
CacheStoreModeUsed as the value of the
javax.persistence.cache.storeModeproperty to specify the behavior when data is read from the database and when data is committed into the database.
CascadeTypeDefines the set of cascadable operations that are propagated to the associated entity. ConstraintModeUsed to control the application of a constraint. DiscriminatorTypeDefines supported types of the discriminator column. EnumTypeDefines mapping for enumerated types. FetchTypeDefines strategies for fetching data from the database. FlushModeTypeFlush mode setting. GenerationTypeDefines the types of primary key generation strategies. InheritanceTypeDefines inheritance strategy options. LockModeType ParameterModeSpecifies the mode of a parameter of a stored procedure query. PersistenceContextTypeSpecifies whether a transaction-scoped or extended persistence context is to be used in
PessimisticLockScopeDefines the values of the
javax.persistence.lock.scopeproperty for pessimistic locking.
SharedCacheModeSpecifies how the provider must use a second-level cache for the persistence unit. SynchronizationTypeSpecifies whether the persistence context is always automatically synchronized with the current transaction or whether the persistence context must be explicitly joined to the current transaction by means of the
TemporalTypeType used to indicate a specific mapping of
ValidationModeThe validation mode to be used by the provider for the persistence unit.
Exception Summary Exception Description EntityExistsExceptionThrown by the persistence provider when
EntityManager.persist(Object)is called and the entity already exists.
EntityNotFoundExceptionThrown by the persistence provider when an entity reference obtained by
EntityManager.getReferenceis accessed but the entity does not exist.
LockTimeoutExceptionThrown by the persistence provider when an pessimistic locking conflict occurs that does not result in transaction rollback. NonUniqueResultException NoResultException OptimisticLockExceptionThrown by the persistence provider when an optimistic locking conflict occurs. PersistenceExceptionThrown by the persistence provider when a problem occurs. PessimisticLockExceptionThrown by the persistence provider when an pessimistic locking conflict occurs. QueryTimeoutExceptionThrown by the persistence provider when a query times out and only the statement is rolled back. RollbackExceptionThrown by the persistence provider when
TransactionRequiredExceptionThrown by the persistence provider when a transaction is required but is not active.
Annotation Types Summary Annotation Type Description AccessUsed to specify an access type to be applied to an entity class, mapped superclass, or embeddable class, or to a specific attribute of such a class. AssociationOverrideUsed to override a mapping for an entity relationship. AssociationOverridesUsed to override mappings of multiple relationship properties or fields. AttributeOverrideUsed to override the mapping of a
Basic(whether explicit or default) property or field or
Idproperty or field.
AttributeOverridesUsed to override mappings of multiple properties or fields. BasicThe simplest type of mapping to a database column. CacheableSpecifies whether an entity should be cached if caching is enabled when the value of the
persistence.xmlcaching element is
CollectionTableSpecifies the table that is used for the mapping of collections of basic or embeddable types. ColumnSpecifies the mapped column for a persistent property or field. ColumnResult ConstructorResultUsed in conjunction with the
SqlResultSetMappingannotation to map the SELECT clause of a SQL query to a constructor.
ConvertSpecifies the conversion of a Basic field or property. ConverterSpecifies that the annotated class is a converter and defines its scope. ConvertsUsed to group
DiscriminatorColumnSpecifies the discriminator column for the
DiscriminatorValueSpecifies the value of the discriminator column for entities of the given type. ElementCollectionSpecifies a collection of instances of a basic type or embeddable class. EmbeddableSpecifies a class whose instances are stored as an intrinsic part of an owning entity and share the identity of the entity. EmbeddedSpecifies a persistent field or property of an entity whose value is an instance of an embeddable class. EmbeddedIdApplied to a persistent field or property of an entity class or mapped superclass to denote a composite primary key that is an embeddable class. EntitySpecifies that the class is an entity. EntityListenersSpecifies the callback listener classes to be used for an entity or mapped superclass. EntityResultUsed in conjunction with the
SqlResultSetMappingannotation to map the SELECT clause of a SQL query to an entity result.
EnumeratedSpecifies that a persistent property or field should be persisted as a enumerated type. ExcludeDefaultListenersSpecifies that the invocation of default listeners is to be excluded for the entity class (or mapped superclass) and its subclasses. ExcludeSuperclassListenersSpecifies that the invocation of superclass listeners is to be excluded for the entity class (or mapped superclass) and its subclasses. FieldResultUsed in conjunction with the
EntityResultannotation to map columns specified in the SELECT list of a SQL query to the properties or fields of an entity class.
ForeignKeyUsed to specify the handling of foreign key constraints when schema generation is in effect. GeneratedValueProvides for the specification of generation strategies for the values of primary keys. IdSpecifies the primary key of an entity. IdClassSpecifies a composite primary key class that is mapped to multiple fields or properties of the entity. IndexUsed in schema generation to specify creation of an index. InheritanceSpecifies the inheritance strategy to be used for an entity class hierarchy. JoinColumnSpecifies a column for joining an entity association or element collection. JoinColumnsSpecifies the mapping for composite foreign keys. JoinTableSpecifies the mapping of associations. LobSpecifies that a persistent property or field should be persisted as a large object to a database-supported large object type. ManyToManySpecifies a many-valued association with many-to-many multiplicity. ManyToOneSpecifies a single-valued association to another entity class that has many-to-one multiplicity. MapKeySpecifies the map key for associations of type
java.util.Mapwhen the map key is itself the primary key or a persistent field or property of the entity that is the value of the map.
MapKeyClassSpecifies the type of the map key for associations of type
MapKeyColumnSpecifies the mapping for the key column of a map whose map key is a basic type. MapKeyEnumeratedSpecifies the enum type for a map key whose basic type is an enumerated type. MapKeyJoinColumnSpecifies a mapping to an entity that is a map key. MapKeyJoinColumnsSupports composite map keys that reference entities. MapKeyTemporalThis annotation must be specified for persistent map keys of type
MappedSuperclassDesignates a class whose mapping information is applied to the entities that inherit from it. MapsIdDesignates a
OneToOnerelationship attribute that provides the mapping for an
EmbeddedIdprimary key, an attribute within an
EmbeddedIdprimary key, or a simple primary key of the parent entity.
NamedAttributeNodeis a member element of a
NamedEntityGraphUsed to specify the path and boundaries for a find operation or query. NamedEntityGraphsUsed to group
NamedNativeQueriesSpecifies multiple native SQL named queries. NamedNativeQuerySpecifies a named native SQL query. NamedQueriesSpecifies multiple named Jakarta Persistence query language queries. NamedQuerySpecifies a static, named query in the Jakarta Persistence query language. NamedStoredProcedureQueriesSpecifies multiple named stored procedure queries. NamedStoredProcedureQuerySpecifies and names a stored procedure, its parameters, and its result type. NamedSubgraphA
NamedSubgraphis a member element of a
OneToManySpecifies a many-valued association with one-to-many multiplicity. OneToOneSpecifies a single-valued association to another entity that has one-to-one multiplicity. OrderBySpecifies the ordering of the elements of a collection valued association or element collection at the point when the association or collection is retrieved. OrderColumnSpecifies a column that is used to maintain the persistent order of a list. PersistenceContextExpresses a dependency on a container-managed
EntityManagerand its associated persistence context.
PersistenceContextsDeclares one or more
PersistencePropertyDescribes a single container or persistence provider property. PersistenceUnitExpresses a dependency on an
EntityManagerFactoryand its associated persistence unit.
PersistenceUnitsDeclares one or more
PostLoadSpecifies a callback method for the corresponding lifecycle event. PostPersistSpecifies a callback method for the corresponding lifecycle event. PostRemoveSpecifies a callback method for the corresponding lifecycle event. PostUpdateSpecifies a callback method for the corresponding lifecycle event. PrePersistSpecifies a callback method for the corresponding lifecycle event. PreRemoveSpecifies a callback method for the corresponding lifecycle event. PreUpdateSpecifies a callback method for the corresponding lifecycle event. PrimaryKeyJoinColumnSpecifies a primary key column that is used as a foreign key to join to another table. PrimaryKeyJoinColumnsGroups
QueryHint SecondaryTableSpecifies a secondary table for the annotated entity class. SecondaryTablesSpecifies multiple secondary tables for an entity. SequenceGeneratorDefines a primary key generator that may be referenced by name when a generator element is specified for the
SequenceGeneratorsUsed to group
SqlResultSetMappingSpecifies the mapping of the result of a native SQL query or stored procedure. SqlResultSetMappingsIs used to define one or more
StoredProcedureParameterSpecifies a parameter of a named stored procedure query. TableSpecifies the primary table for the annotated entity. TableGeneratorDefines a primary key generator that may be referenced by name when a generator element is specified for the
TableGeneratorsUsed to group
TemporalThis annotation must be specified for persistent fields or properties of type
TransientSpecifies that the property or field is not persistent. UniqueConstraintSpecifies that a unique constraint is to be included in the generated DDL for a primary or secondary table. VersionSpecifies the version field or property of an entity class that serves as its optimistic lock value.