Class AbstractHibernateQueryProvider<T>
- java.lang.Object
- org.springframework.batch.item.database.orm.AbstractHibernateQueryProvider<T>
- All Implemented Interfaces:
HibernateQueryProvider<T>
- Direct Known Subclasses:
HibernateNativeQueryProvider
public abstract class AbstractHibernateQueryProvider<T> extends java.lang.Object implements HibernateQueryProvider<T>
Abstract Hibernate Query Provider to serve as a base class for all Hibernate
Queryproviders.The implementing provider can be configured to use either
StatelessSessionsufficient for simple mappings without the need to cascade to associated objects or standard HibernateSessionfor more advanced mappings or when caching is desired.- Since:
- 2.1
- Author:
- Anatoly Polinsky, Dave Syer
Constructor Summary
Constructors Constructor Description AbstractHibernateQueryProvider()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.hibernate.SessiongetStatefulSession()protected org.hibernate.StatelessSessiongetStatelessSession()booleanisStatelessSession()voidsetSession(org.hibernate.Session statefulSession)Inject aSessionthat can be used as a factory for queries.voidsetStatelessSession(org.hibernate.StatelessSession statelessSession)Inject aStatelessSessionthat can be used as a factory for queries.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.batch.item.database.orm.HibernateQueryProvider
createQuery
Method Detail
setStatelessSession
public void setStatelessSession(org.hibernate.StatelessSession statelessSession)
Description copied from interface:HibernateQueryProviderInject a
StatelessSessionthat can be used as a factory for queries. The state of the session is controlled by the caller (i.e. it should be closed if necessary).Use either this method or
HibernateQueryProvider.setSession(Session)- Specified by:
setStatelessSessionin interfaceHibernateQueryProvider<T>- Parameters:
statelessSession- theStatelessSessionto set
setSession
public void setSession(org.hibernate.Session statefulSession)
Description copied from interface:HibernateQueryProviderInject a
Sessionthat can be used as a factory for queries. The state of the session is controlled by the caller (i.e. it should be closed if necessary).Use either this method or
HibernateQueryProvider.setStatelessSession(StatelessSession)- Specified by:
setSessionin interfaceHibernateQueryProvider<T>- Parameters:
statefulSession- theSessionto set
isStatelessSession
public boolean isStatelessSession()
getStatelessSession
protected org.hibernate.StatelessSession getStatelessSession()
getStatefulSession
protected org.hibernate.Session getStatefulSession()