org.springframework.batch.item.database.orm
Class AbstractHibernateQueryProvider

java.lang.Object
  extended by org.springframework.batch.item.database.orm.AbstractHibernateQueryProvider
All Implemented Interfaces:
HibernateQueryProvider
Direct Known Subclasses:
HibernateNativeQueryProvider

public abstract class AbstractHibernateQueryProvider
extends Object
implements HibernateQueryProvider

Abstract Hibernate Query Provider to serve as a base class for all Hibernate Query providers.

The implementing provider can be configured to use either StatelessSession sufficient for simple mappings without the need to cascade to associated objects or standard Hibernate Session for more advanced mappings or when caching is desired.

Since:
2.1
Author:
Anatoly Polinsky, Dave Syer

Constructor Summary
AbstractHibernateQueryProvider()
           
 
Method Summary
protected  org.hibernate.Session getStatefulSession()
           
protected  org.hibernate.StatelessSession getStatelessSession()
           
 boolean isStatelessSession()
           
 void setSession(org.hibernate.Session statefulSession)
           Inject a Session that can be used as a factory for queries.
 void setStatelessSession(org.hibernate.StatelessSession statelessSession)
           Inject a StatelessSession that 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
 

Constructor Detail

AbstractHibernateQueryProvider

public AbstractHibernateQueryProvider()
Method Detail

setStatelessSession

public void setStatelessSession(org.hibernate.StatelessSession statelessSession)
Description copied from interface: HibernateQueryProvider

Inject a StatelessSession that 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:
setStatelessSession in interface HibernateQueryProvider
Parameters:
statelessSession - the StatelessSession to set

setSession

public void setSession(org.hibernate.Session statefulSession)
Description copied from interface: HibernateQueryProvider

Inject a Session that 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:
setSession in interface HibernateQueryProvider
Parameters:
statefulSession - the Session to set

isStatelessSession

public boolean isStatelessSession()

getStatelessSession

protected org.hibernate.StatelessSession getStatelessSession()

getStatefulSession

protected org.hibernate.Session getStatefulSession()


Copyright © 2013 SpringSource. All Rights Reserved.