This package defines the central Hibernate APIs, beginning with
APIs related to querying are now defined under the namespace
SessionFactory, which represents an instance of Hibernate at runtime and is the source of new instances of
StatelessSession, the most important APIs exposing persistence-related operations for entities. The interface
SharedSessionContractdeclares operations that are common to both stateful and stateless sessions.
APIs related to querying are now defined under the namespace
Interface Summary Interface Description CacheAn API for directly querying and managing the second-level cache. CustomEntityDirtinessStrategyDuring a flush cycle, Hibernate needs to determine which of the entities associated with a
Sessionare dirty, meaning modified.
CustomEntityDirtinessStrategy.AttributeCheckerResponsible for identifying when attributes are dirty. CustomEntityDirtinessStrategy.AttributeInformationProvides
CustomEntityDirtinessStrategy.AttributeCheckerwith meta information about the attributes being checked.
CustomEntityDirtinessStrategy.DirtyCheckContextA callback to drive dirty checking. EntityNameResolverAn object capable of determining the entity name for a given entity instance. FilterAllows control over an enabled filter at runtime. IdentifierLoadAccess<T>Loads an entity by its primary identifier. InterceptorAllows user code to inspect and/or change entity property values before they are written to the database, or after they are read from the database. LobHelper Metamodel Deprecated.Prefer
MultiIdentifierLoadAccess<T>Loads multiple instances of a given entity type at once, by specifying a list of identifier values. NaturalIdLoadAccess<T>Loads an entity by its natural identifier, which may be a composite value comprising more than one attribute of the entity. NaturalIdMultiLoadAccess<T>Loads multiple instances of a given entity type at once, by specifying a list of natural id values. ScrollableResults<R>A result iterator that allows moving around within the results by arbitrary increments. SessionThe main runtime interface between a Java application and Hibernate. Session.LockRequest Deprecated. SessionBuilderAllows creation of a new
Sessionwith specific options.
SessionEventListenerImplemented by custom listeners that respond to low-level events involving interactions between the
Sessionand the database or second-level cache.
SessionFactoryrepresents an "instance" of Hibernate: it maintains the runtime metamodel representing persistent entities, their attributes, their associations, and their mappings to relational database tables, along with configuration that affects the runtime behavior of Hibernate, and instances of services that Hibernate needs to perform its duties.
SessionFactoryObserverAllows reaction to basic
SessionBuilderwith access to stuff from another session.
SharedSessionContract SimpleNaturalIdLoadAccess<T>Loads an entity by its natural identifier. StatelessSessionA command-oriented API often used for performing bulk operations against the database. StatelessSessionBuilderAllows creation of a new
StatelessSessionwith specific options.
TransactionRepresents a resource-local transaction, where resource-local is interpreted by Hibernate to mean any transaction under the control of Hibernate.
Class Summary Class Description BaseSessionEventListenerA no-op implementation of SessionEventListener. EmptyInterceptor Deprecated.implement
HibernateVarious utility functions for working with proxies and lazy collection references. Hibernate.CollectionInterface<C>Operations for obtaining references to persistent collections of a certain type. LengthDefines a list of useful constant values that may be used to specify long column lengths in the JPA
LockOptionsContains a set of options describing how a row of a database table mapped by an entity should be locked. VersionInformation about the version of Hibernate.
Enum Summary Enum Description CacheMode ConnectionAcquisitionModeIndicates the manner in which JDBC connections are acquired. ConnectionReleaseModeEnumerates various policies for releasing JDBC connections. DuplicateMappingException.TypeEnumeration of the types of things that can be duplicated. FetchModeRepresents an association fetching strategy. FlushModeRepresents a flushing strategy. LockModeInstances represent a lock mode for a row of a relational database table. ReplicationMode Deprecated.since
Session.replicate(Object, ReplicationMode)is deprecated
ScrollMode TimeZoneStorageStrategyEnumerates the possible storage strategies for offset or zoned datetimes.
Exception Summary Exception Description AnnotationExceptionAn exception that occurs while reading mapping annotations. AssertionFailureIndicates failure of an assertion: a possible bug in Hibernate. CallbackException DuplicateMappingExceptionRaised whenever a duplicate for a certain type occurs, such as a duplicate class, table, or property name. FetchNotFoundExceptionException for
HibernateErrorMarks a group of exceptions that generally indicate an internal Hibernate error or bug. HibernateExceptionThe base type for exceptions thrown by Hibernate. InstantiationExceptionThrown if Hibernate can't instantiate a class at runtime. InvalidMappingExceptionThrown when a mapping is found to be invalid. JDBCExceptionWraps a
SQLExceptionarising from the JDBC driver.
LazyInitializationExceptionIndicates an attempt to access unfetched data outside the context of an open stateful
MappingExceptionAn exception that occurs while reading mapping sources, either XML or annotations, usually as a result of something screwy in the O/R mappings. NonUniqueObjectExceptionThis exception is thrown when an operation would break session-scoped identity. NonUniqueResultException ObjectDeletedExceptionThrown when the user tries to do something illegal with a deleted object. ObjectNotFoundExceptionThrown when
EntityManager.find(Class, Object)fails to select a row with the given primary key (identifier value).
PersistentObjectExceptionThrown when the user passes a persistent instance to a
Sessionmethod that expects a transient instance.
PessimisticLockExceptionThrown when a pessimistic locking conflict occurs. PropertyAccessExceptionA problem occurred accessing a property of an instance of a persistent class by reflection, or via enhanced entities. PropertyNotFoundExceptionIndicates that an expected getter or setter method could not be found on a class. PropertySetterAccessException PropertyValueExceptionThrown when the (illegal) value of a property can not be persisted. QueryExceptionA problem occurred translating a Hibernate query to SQL due to illegal query syntax, an operation which is not well-typed, an unresolvable reference to an entity or attribute, an unknown named query, or any similar problem. QueryParameterExceptionIndicates a problem with the runtime arguments bound to query parameters. QueryTimeoutExceptionThrown when a database query timeout occurs. ResourceClosedException SessionExceptionThrown when the user calls a method of a
Sessionthat is in an inappropriate state for the given call (for example, the session is closed or disconnected).
StaleStateExceptionthat carries information about the particular entity instance that was the source of the failure.
StaleStateExceptionThrown when a version number or timestamp check failed, indicating that the
Sessioncontained stale data (when using long transactions with versioning).
TransactionExceptionIndicates that a transaction could not be begun, committed or rolled back. TransactionManagementExceptionThrown when user code causes the end of a transaction that is being managed by the
TransientObjectExceptionThrown when the user passes a transient instance to a
Sessionmethod that expects a persistent instance.
TransientPropertyValueExceptionThrown when a property cannot be persisted because it is an association with a transient unsaved entity instance. TypeMismatchExceptionUsed when a user provided type does not match the expected one. UnknownEntityTypeExceptionIndicates an attempt was made to refer to an unknown entity name or class. UnknownFilterExceptionIndicates a request against an unknown filter name. UnknownProfileExceptionIndicates a request against an unknown fetch profile name. UnresolvableObjectExceptionThrown when Hibernate could not resolve an object by id, especially when loading an association. UnsupportedLockAttemptExceptionThis exception is thrown when an invalid
LockModeis selected for an entity.
WrongClassExceptionThrown when loading an entity (by identifier) results in a value that cannot be treated as the subclass type requested by the caller.
Annotation Types Summary Annotation Type Description IncubatingMarks the annotated Java element as incubating, potentially recursively. InternalMarks the annotated Java element as forming part of the internal implementation of Hibernate, meaning that clients should expect absolutely no guarantees with regard to the binary stability from release to release. RemoveIndicates that the annotated element is planned for removal as part of a deprecation process.