Top Description Fields Constructors Methods
org.springframework.orm.hibernate5

public Class SessionHolder

extends EntityManagerHolder
Class Inheritance
Imports
org.hibernate.FlushMode, .Session, .Transaction, org.springframework.lang.Nullable, org.springframework.orm.jpa.EntityManagerHolder

Resource holder wrapping a Hibernate Session (plus an optional Transaction). HibernateTransactionManager binds instances of this class to the thread, for a given org.hibernate.SessionFactory. Extends EntityManagerHolder as of 5.1, automatically exposing an EntityManager handle on Hibernate 5.2+.

Note

This is an SPI class, not intended to be used by applications.

Author
Juergen Hoeller
Since
4.2
See Also
HibernateTransactionManager, SessionFactoryUtils

Field Summary

Modifier and TypeField and Description
private FlushMode
private Transaction

Constructor Summary

AccessConstructor and Description
public
SessionHolder(Session session)

Deprecated as a consequence of Session being deprecated.

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Overrides org.springframework.orm.jpa.EntityManagerHolder.clear.

Clear the transactional state of this resource holder.
public FlushMode
public Session
getSession()

Deprecated as a consequence of Session being deprecated.
public Transaction
public void
setPreviousFlushMode(FlushMode previousFlushMode)

public void
Inherited from org.springframework.orm.jpa.EntityManagerHolder:
getEntityManagergetSavepointManagerisTransactionActivesetSavepointManagersetTransactionActive

Field Detail

previousFlushModeback to summary
private FlushMode previousFlushMode
Annotations
@Nullable
transactionback to summary
private Transaction transaction
Annotations
@Nullable

Constructor Detail

SessionHolderback to summary
public SessionHolder(Session session)

Deprecated

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

Method Detail

clearback to summary
public void clear()

Overrides org.springframework.orm.jpa.EntityManagerHolder.clear.

Doc from org.springframework.transaction.support.ResourceHolderSupport.clear.

Clear the transactional state of this resource holder.

Annotations
@Override
getPreviousFlushModeback to summary
public FlushMode getPreviousFlushMode()
Annotations
@Nullable
getSessionback to summary
public Session getSession()

Deprecated

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

getTransactionback to summary
public Transaction getTransaction()
Annotations
@Nullable
setPreviousFlushModeback to summary
public void setPreviousFlushMode(FlushMode previousFlushMode)
setTransactionback to summary
public void setTransaction(Transaction transaction)