Top Description Interfaces Annotations Classes Enums
[default module]

Package org.hibernate


This package defines the central Hibernate APIs, beginning with org.hibernate.SessionFactory, which represents an instance of Hibernate at runtime and is the source of new instances of org.hibernate.Session and org.hibernate.StatelessSession, the most important APIs exposing persistence-related operations for entities. The interface org.hibernate.SharedSessionContract declares operations that are common to both stateful and stateless sessions.

Playing important supporting roles here, we also have org.hibernate.Transaction, org.hibernate.Filter, and org.hibernate.Cache.

APIs related to querying are now defined under the namespace org.hibernate.query.

Interface Summary

Modifier and TypeInterface and Description
public interface
Cache

An API for directly querying and managing the second-level cache.

public interface
CustomEntityDirtinessStrategy

During a flush cycle, Hibernate needs to determine which of the entities associated with a Session are dirty, meaning modified.

public interface
EntityNameResolver

An object capable of determining the entity name for a given entity instance.

public interface
Filter

Allows control over an enabled filter at runtime.

public interface
IdentifierLoadAccess<T>

Loads an entity by its primary identifier.

public interface
Interceptor

Allows 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.

public interface
LobHelper

A factory for instances of Blob and Clob used for writing LOB data.

public interface
Metamodel

Deprecated since 6.0. Prefer JpaMetamodel
public interface
MultiIdentifierLoadAccess<T>

Loads multiple instances of a given entity type at once, by specifying a list of identifier values.

public interface
NaturalIdLoadAccess<T>

Loads an entity by its natural identifier, which may be a composite value comprising more than one attribute of the entity.

public interface
NaturalIdMultiLoadAccess<T>

Loads multiple instances of a given entity type at once, by specifying a list of natural id values.

public interface
ScrollableResults<R>

A result iterator that allows moving around within the results by arbitrary increments.

public interface
Session

The main runtime interface between a Java application and Hibernate.

public interface
SessionBuilder

Allows creation of a new Session with specific options.

public interface
SessionEventListener

Implemented by custom listeners that respond to low-level events involving interactions between the Session and the database or second-level cache.

public interface
SessionFactory

A SessionFactory represents 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.

public interface
SessionFactoryObserver

Allows reaction to basic SessionFactory lifecycle events.

public interface
SharedSessionBuilder

Specialized SessionBuilder with access to stuff from another session.

public interface
SharedSessionContract

Declares operations that are common between Session and StatelessSession.

public interface
SimpleNaturalIdLoadAccess<T>

Loads an entity by its natural identifier.

public interface
StatelessSession

A command-oriented API often used for performing bulk operations against the database.

public interface
StatelessSessionBuilder

Allows creation of a new StatelessSession with specific options.

public interface
Transaction

Represents a resource-local transaction, where resource-local is interpreted by Hibernate to mean any transaction under the control of Hibernate.

Annotation Summary

Modifier and TypeAnnotation and Description
public @interface
Incubating

Marks the annotated Java element as incubating, potentially recursively.

public @interface
Internal

Marks 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.

public @interface
Remove

Indicates that the annotated element is planned for removal as part of a deprecation process.

Class Summary

Modifier and TypeClass and Description
public class
AnnotationException

An exception that occurs while reading mapping annotations.

public class
AssertionFailure

Indicates failure of an assertion: a possible bug in Hibernate.

public class
BaseSessionEventListener

A no-op implementation of SessionEventListener.

public class
CallbackException

Intended to be thrown from org.hibernate.classic.Lifecycle and Interceptor callbacks.

public class
DuplicateMappingException

Raised whenever a duplicate for a certain type occurs, such as a duplicate class, table, or property name.

public class
EmptyInterceptor

Deprecated since 6.0. implement Interceptor directly
An interceptor that does nothing.
public class
public class
Hibernate

Various utility functions for working with proxies and lazy collection references.

public class
HibernateError

Marks a group of exceptions that generally indicate an internal Hibernate error or bug.

public class
HibernateException

The base type for exceptions thrown by Hibernate.

public class
InstantiationException

Thrown if Hibernate can't instantiate a class at runtime.

public class
InvalidMappingException

Thrown when a mapping is found to be invalid.

public class
JDBCException

Wraps a SQLException arising from the JDBC driver.

public class
LazyInitializationException

Indicates an attempt to access unfetched data outside the context of an open stateful Session.

public class
Length

Defines a list of useful constant values that may be used to specify long column lengths in the JPA jakarta.persistence.Column annotation.

public class
LockOptions

Contains a set of options describing how a row of a database table mapped by an entity should be locked.

public class
MappingException

An exception that occurs while reading mapping sources, either XML or annotations, usually as a result of something screwy in the O/R mappings.

public class
NonUniqueObjectException

This exception is thrown when an operation would break session-scoped identity.

public class
NonUniqueResultException

Thrown when the application calls Query#getSingleResult() or Query#uniqueResult() and the query returns more than one row from the database.

public class
ObjectDeletedException

Thrown when the user tries to do something illegal with a deleted object.

public class
ObjectNotFoundException

Thrown when Session#find(Class, Object) fails to select a row with the given primary key (identifier value).

public class
PersistentObjectException

Thrown when the user passes a persistent instance to a Session method that expects a transient instance.

public class
PessimisticLockException

Thrown when a pessimistic locking conflict occurs.

public class
PropertyAccessException

A problem occurred accessing a property of an instance of a persistent class by reflection, or via enhanced entities.

public class
PropertyNotFoundException

Indicates that an expected getter or setter method could not be found on a class.

public class
public class
PropertyValueException

Thrown when the (illegal) value of a property can not be persisted.

public class
QueryException

A 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.

public class
QueryParameterException

Indicates a problem with the runtime arguments bound to query parameters.

public class
QueryTimeoutException

Thrown when a database query timeout occurs.

public class
ResourceClosedException

Indicates an attempt was made to use a closed resource, such as a closed Session or SessionFactory.

public class
SessionException

Thrown when the user calls a method of a Session that is in an inappropriate state for the given call (for example, the session is closed or disconnected).

public class
StaleObjectStateException

A specialized StaleStateException that carries information about the particular entity instance that was the source of the failure.

public class
StaleStateException

Thrown when a version number or timestamp check failed, indicating that the Session contained stale data (when using long transactions with versioning).

public class
TransactionException

Indicates that a transaction could not be begun, committed or rolled back.

public class
TransactionManagementException

Thrown when user code causes the end of a transaction that is being managed by the SessionFactory.

public class
TransientObjectException

Thrown when the user passes a transient instance to a Session method that expects a persistent instance.

public class
TransientPropertyValueException

Thrown when a property cannot be persisted because it is an association with a transient unsaved entity instance.

public class
TypeMismatchException

Used when a user provided type does not match the expected one.

public class
UnknownEntityTypeException

Indicates an attempt was made to refer to an unknown entity name or class.

public class
UnknownFilterException

Indicates a request against an unknown filter name.

public class
UnknownProfileException

Indicates a request against an unknown fetch profile name.

public class
UnresolvableObjectException

Thrown when Hibernate could not resolve an object by id, especially when loading an association.

public class
UnsupportedLockAttemptException

This exception is thrown when an invalid LockMode is selected for an entity.

public class
Version

Information about the version of Hibernate.

public class
WrongClassException

Thrown when loading an entity (by identifier) results in a value that cannot be treated as the subclass type requested by the caller.

Enum Summary

Modifier and TypeEnum and Description
public enum
CacheMode

Controls how the session interacts with the second-level cache or query cache.

public enum
ConnectionAcquisitionMode

Indicates the manner in which JDBC connections are acquired.

public enum
ConnectionReleaseMode

Enumerates various policies for releasing JDBC connections.

public enum
FetchMode

Represents an association fetching strategy.

public enum
FlushMode

Represents a flushing strategy.

public enum
LockMode

Instances represent a lock mode for a row of a relational database table.

public enum
ReplicationMode

Deprecated since 6.2. since Session#replicate(Object, ReplicationMode) is deprecated
Represents a replication strategy used by Session#replicate(Object, ReplicationMode).
public enum
ScrollMode

Specifies the type of JDBC scrollable result set to use underneath a ScrollableResults.

public enum
TimeZoneStorageStrategy

Enumerates the possible storage strategies for offset or zoned datetimes.