Package jakarta.persistence
package jakarta.persistence
Jakarta Persistence is the API for the management for persistence and object/relational mapping.
-
ClassDescriptionUsed 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.Used 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.Used to override a mapping for an entity relationship.Used to override mappings of multiple relationship properties or fields.AttributeConverter<X,Y> Interface implemented by custom attribute converters.Represents an attribute node of an entity graph.Used to override the mapping of aBasic(whether explicit or default) property or field orIdproperty or field.Used to override mappings of multiple properties or fields.The simplest type of mapping of a persistent field or property to a single database column.Interface used to interact with the second-level cache.Specifies whether an entity should be cached, if caching is enabled, and when the value of thepersistence.xmlcaching element isSharedCacheMode.ENABLE_SELECTIVEorSharedCacheMode.DISABLE_SELECTIVE.Specifies how theEntityManagerinteracts with the second-level cache when data is read from the database via theEntityManager.find(Class, Object, Map)methods and execution of queries.Specifies how theEntityManagerinteracts with the second-level cache when data is read from the database and when data is written to the database.Defines the set of cascadable operations that are propagated to the associated entity.Used to specify a SQL check constraint on a column or table when schema generation is in effect.Specifies the table that is used for the mapping of collections of basic or embeddable types.Specifies the column mapped by the annotated persistent property or field.Used in conjunction with theSqlResultSetMapping,NamedNativeQuery, orConstructorResultannotation to map a column of theSELECTlist of a SQL query to a scalar (non-entity) value.An executable action which makes use of a native database connection.ConnectionFunction<C,T> A function which makes use of a native database connection to compute a result.Used to control the application of a constraint.Used in conjunction with theSqlResultSetMappingorNamedNativeQueryannotation to map theSELECTclause of a SQL query to the constructor of an arbitrary Java class.Specifies how the values of a field or property are converted to a basic type, enabling a converter definedautoApply=false, overriding the use of a converter definedautoApply=true, or overriding the use of a converter specified by a field or property of an embedded type or inherited mapped superclass.Declares that the annotated class is a converter and specifies whether the converter is automatically applied.Used to groupConvertannotations.Defines supported types of the discriminator column.Specifies the value of the discriminator column for the annotated entity type.Declares a collection of instances of a basic type or embeddable class.Declares a type whose instances are stored as an intrinsic part of an owning entity, sharing the identity of the entity.Declares a persistent field or property of an entity whose value is an instance of an embeddable class.Specifies that the annotated persistent field or property of an entity class or mapped superclass is the composite primary key of the entity.Declares that the annotated class is an entity.Provides entity operations that are performed independently of a persistence context.Thrown by the persistence provider when: a detached instance of an entity type is passed toEntityManager.persist(Object), or an instance of an entity type with an identifier already assigned by the application is passed toEntityAgent.insert(Object), and a record with the assigned identifier value already exists in the database.EntityGraph<T>An entity graph is a template that captures the boundaries of an operation or query.Declares operations common toEntityManagerandEntityAgent.Represents the registration of an entity lifecycle event listener with theEntityManagerFactory.Specifies the entity listener classes associated with the annotated class.Interface used to interact with the persistence context.Interface used to interact with the persistence unit, and to create new instances ofEntityManagerandEntityAgent.Thrown by the persistence provider when:EntityHandler.get(Class, Object)cannot return an instance of the requested entity type because there is no matching record in the database, an entity reference obtained by callingEntityManager.getReference(Class, Object)is accessed but the reference has no corresponding record in the database, an entity is passed toEntityManager.refresh(Object)orEntityAgent.refresh(Object)and its record no longer exists in the database, an entity is passed toEntityManager.lock(Object, LockModeType), a pessimistic lock mode is requested, and the record no longer exists in the database.Used in conjunction with theSqlResultSetMappingorNamedNativeQueryannotation to map theSELECTclause of a SQL query to an entity result.Interface used to control transactions involving resource-local entity managers and entity agents.Specifies that a persistent property or field should be persisted as an enumerated type.Specifies that an annotated field of a Javaenumtype is the source of database column values for an enumerated mapping.Enumerates available options for mapping enumerated types.Specifies that the invocation of default listeners is to be excluded for the entity class (or mapped superclass) and its subclasses.Specifies that mutation of the annotated field or property does not result in incrementation of the version field or property of the entity.Specifies that the invocation of superclass listeners is to be excluded for the entity class (or mapped superclass) and its subclasses.Defines policies for fetching data from the database.Used in conjunction with theEntityResultannotation to map a column specified in theSELECTlist of a SQL query to a property or field of an entity class.An option influencing the behavior ofEntityHandler.find(Class, Object),EntityHandler.findMultiple(Class, List, FindOption...),EntityHandler.get(Class, Object), orEntityHandler.getMultiple(Class, List, FindOption...).Enumerates flush modes recognized by theEntityManager.Specifies the handling of foreign key constraints when schema generation is in effect.Specifies a generation strategy for generated primary keys.Enumerates the defined primary key generation strategies.Graph<T>Declares operations common toEntityGraphandSubgraph, most importantly, operations for adding and removing attribute nodes and for creating subgraphs.Identifies the primary key field or property of an entity class.Specifies a composite primary key type whose fields or properties map to the identifier fields or properties of the annotated entity class.Used in schema generation to specify creation of an index.Specifies the inheritance mapping strategy for the entity class hierarchy which descends from the annotated entity class.Enumerates the options for mapping entity inheritance.Specifies a column for joining an entity association or element collection.Specifies the mapping for composite foreign keys.Specifies the mapping of an association to an intermediate join table.Specifies that the annotated persistent property or field should be persisted as a large object to a database-native large object (LOB) type.Enumerates the kinds of optimistic or pessimistic lock which may be obtained on an entity instance.An option influencing the behavior ofEntityManager.lock(Object, LockModeType).Thrown by the persistence provider when a pessimistic locking conflict occurs that does not result in transaction rollback.Specifies a many-valued association with many-to-many multiplicity, mapping to an intermediate table called the join table.Specifies a single-valued association to another entity class that has many-to-one multiplicity.Specifies the map key for associations of typeMapwhen the map key is itself the primary key or a persistent field or property of the entity that is the value of the map.Specifies the type of the map key for associations of typeMap.Specifies the mapping for the key column of a map whose map key is a basic type.Specifies the enum type for a map key whose basic type is an enumerated type.Specifies a mapping to an entity that is a map key.Supports composite map keys that reference entities.Deprecated.Declares a class which is not itself an entity, but whose mappings are inherited by the entities which extend it.Designates aManyToOneorOneToOnerelationship attribute that provides the mapping for anEmbeddedIdprimary key, an attribute within anEmbeddedIdprimary key, or a simple primary key of the parent entity.Declares an attribute node as a member element of aNamedEntityGraph.Declares a named entity graph or subgraph of a named entity graph.Declares that the annotated attribute is an attribute node in a named entity graph.GroupsNamedEntityGraphAttributeNodeannotations.Used to groupNamedEntityGraphannotations.Declares that the annotated association is the root of a subgraph of a named entity graph.GroupsNamedEntityGraphSubgraphannotations.Declares multiple native SQL named queries.Declares a named native SQL query and, optionally, the mapping of the result of the native SQL query.Declares a named statement written in native SQL.Declares multiple named native SQL statements.Declares multiple named Jakarta Persistence query language queries.Declares a named query written in the Jakarta Persistence Query Language.Declares a named statement written in the Jakarta Persistence Query Language.Declares multiple named Jakarta Persistence query language statements.Specifies multiple named stored procedure queries.Declares and names a stored procedure, its parameters, and its result type.Declares a subgraph as a member element of aNamedEntityGraph.Thrown by the persistence provider whenQuery.getSingleResult(),TypedQuery.getSingleResult(),Query.getSingleResultOrNull(), orTypedQuery.getSingleResultOrNull()is executed and the query has more than one result.Thrown by the persistence provider whenQuery.getSingleResult()orTypedQuery.getSingleResult()is executed and there is no query result to return.Specifies a many-valued association with one-to-many multiplicity.Specifies a single-valued association to another entity class that has one-to-one multiplicity.Thrown by the persistence provider when an optimistic locking conflict occurs.Specifies the ordering of the elements of a collection-valued association or element collection at the point when the association or collection is retrieved.Specifies a column that is used to maintain the persistent order of a list.Parameter<T>Represents a parameter of a query.Specifies the mode of a parameter of a stored procedure query.Bootstrap class used to obtain anEntityManagerFactoryin Java SE environments.Properties used to control the integration with CDI.Properties used to configure the second-level cache.Properties used to connect to the database via JDBC in Java SE.Properties used to specify the database platform when JDBC metadata is not available.Properties used to optimize the interaction with JDBC.Properties used to control the schema management tooling.Properties used to override elements the configuration of a persistence unit inpersistence.xml.Properties used to control the integration with Bean Validation.Represents a configuration of a persistence unit, allowing programmatic creation of anEntityManagerFactory.Expresses a dependency on a container-managedEntityManagerand its associated persistence context.Declares one or morePersistenceContextannotations.Specifies the lifecycle of a container-managed persistence context in a Jakarta EE container environment.Thrown by the persistence provider when a problem occurs.Describes a single container or persistence provider property.Expresses a dependency on anEntityManagerFactoryand its associated persistence unit.Declares one or morePersistenceUnitannotations.Enumerates the possible approaches to transaction management in Jakarta Persistence.Utility interface between the application and the persistence provider managing the persistence unit.Utility interface between the application and the persistence provider(s).Thrown by the persistence provider when a pessimistic locking conflict occurs.Controls how a pessimistic lock applied to an entity affects associated collections and relationships.Declares a callback method for the corresponding lifecycle event.Declares a callback method for the corresponding lifecycle event.Declares a callback method for the corresponding lifecycle event.Declares a callback method for the corresponding lifecycle event.Declares a callback method for the corresponding lifecycle event.Declares a callback method for the corresponding lifecycle event.Declares a callback method for the corresponding lifecycle event.Declares a callback method for the corresponding lifecycle event.Declares a callback method for the corresponding lifecycle event.Declares a callback method for the corresponding lifecycle event.Declares a callback method for the corresponding lifecycle event.Declares a callback method for the corresponding lifecycle event.Declares a callback method for the corresponding lifecycle event.Declares a callback method for the corresponding lifecycle event.Specifies a primary key column that is used as a foreign key to join to another table.Specifies the mapping for a composite foreign key which is also a primary key.Declares common operations for controlling the execution of statements and queries written in the Jakarta Persistence query language or in native SQL.Used to supply a query property or hint to theNamedQueryorNamedNativeQueryannotation.Thrown by the persistence provider when a query times out and only the statement is rolled back.A reference to a named statement or query declared via theNamedQueryorNamedNativeQueryannotations, or usingStaticQueryorStaticNativeQuery.An option influencing the behavior ofEntityManager.refresh(Object).Thrown by the persistence provider when a resource-local transaction cannot be committed, that is, whenEntityTransaction.commit()fails.Represents an action that can be performed by the schema management tooling.Allows programmatic schema creation, schema validation, data cleanup, and data loading, and schema cleanup for entities belonging to a certain persistence unit.Thrown when schema validation fails.Specifies a secondary table for the annotated entity class.Specifies multiple secondary tables for an entity.Defines a primary key generator that may be referenced by name when a generator element is specified for theGeneratedValueannotation.Used to groupSequenceGeneratorannotations.Enumerates policies which control how the provider determines if an entity type is eligible for storage in the second-level cache.Specifies an explicit mapping of the columns of a result set of a native SQL query or stored procedure to entity classes, scalar values, and Java class constructors.Used to define one or moreSqlResultSetMappingannotations.Interface used to control the execution of executable statements.A reference to an executable named statement for an operation that returns a row count.Declares a parameter of a named stored procedure query.Interface used to control execution of a stored procedure query.Subgraph<T>This type represents a subgraph for an attribute node that corresponds to a managed type.Specifies whether the persistence context associated with anEntityManageris always automatically synchronized with the current transaction.Specifies the primary table mapped by the annotated entity type.Defines a primary key generator that may be referenced by name when a generator element is specified for theGeneratedValueannotation.Used to groupTableGeneratorannotations.Deprecated.Newly written code should use the date/time types defined injava.time.Deprecated.Newly written code should use the date/time types defined injava.time.Specifies a timeout for a database request.Thrown by the persistence provider when a transaction is required but is not active.Specifies that the annotated property or field is not persistent.Interface for extracting the elements of a query result tuple.TupleElement<X>TheTupleElementinterface defines an element that is returned in a query result tuple.TypedQuery<X>Interface used to control the execution of typed queries.A reference to a typed named query declared via theNamedQueryorNamedNativeQueryannotations, or usingStaticQueryorStaticNativeQuery.Specifies that a unique constraint is to be included in the generated DDL for a primary or secondary table.The validation mode to be used by the provider for the persistence unit.Declares the version field or property of an entity class, which is used to detect optimistic locking conflicts, ensuring the integrity of optimistic transactions.
java.time.