Top Description Methods
org.springframework.orm.hibernate5

public Interface HibernateCallback<T>

Annotations
@FunctionalInterface
Type Parameters
<T>
the result type
Imports
org.hibernate.HibernateException, .Session, org.springframework.lang.Nullable

Callback interface for Hibernate code. To be used with HibernateTemplate's execution methods, often as anonymous classes within a method implementation. A typical implementation will call Session.load/find/update to perform some operations on persistent objects.
Author
Juergen Hoeller
Since
4.2
See Also
HibernateTemplate, HibernateTransactionManager

Method Summary

Modifier and TypeMethod and Description
public T

Returns:

a result object, or null if none
doInHibernate
(Session
active Hibernate session
session
)

Deprecated as a consequence of Session being deprecated.
Gets called by HibernateTemplate.execute with an active Hibernate Session.

Method Detail

doInHibernateback to summary
public T doInHibernate(Session session) throws HibernateException

Deprecated

as a consequence of Session being deprecated. See corresponding docs for further information.

Gets called by HibernateTemplate.execute with an active Hibernate Session. Does not need to care about activating or closing the Session, or handling transactions.

Allows for returning a result object created within the callback, i.e. a domain object or a collection of domain objects. A thrown custom RuntimeException is treated as an application exception: It gets propagated to the caller of the template.

Parameters
session:Session

active Hibernate session

Returns:T

a result object, or null if none

Annotations
@Nullable
Exceptions
HibernateException:
if thrown by the Hibernate API
See Also
HibernateTemplate#execute