|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.batch.item.database.HibernateItemWriter<T>
public class HibernateItemWriter<T>
ItemWriter that uses a Hibernate session to save or update entities
that are not part of the current Hibernate session. It will also flush the
session at chunk boundaries. It will also flush and clear the session at
chunk boundaries by default (@see ).
The writer is thread safe after its properties are set (normal singleton
behavior), so it can be used to write in multiple concurrent transactions.
| Field Summary | |
|---|---|
protected static org.apache.commons.logging.Log |
logger
|
| Constructor Summary | |
|---|---|
HibernateItemWriter()
|
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
Check mandatory properties - there must be a hibernateTemplate. |
protected void |
doWrite(org.springframework.orm.hibernate3.HibernateOperations hibernateTemplate,
java.util.List<? extends T> items)
Do perform the actual write operation. |
void |
setClearSession(boolean clearSession)
Flag to indicate that the session should be cleared and flushed at the end of the write (default true). |
void |
setHibernateTemplate(org.springframework.orm.hibernate3.HibernateOperations hibernateTemplate)
Public setter for the HibernateOperations property. |
void |
setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Set the Hibernate SessionFactory to be used internally. |
void |
write(java.util.List<? extends T> items)
Save or update any entities not in the current hibernate session and then flush the hibernate session. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.commons.logging.Log logger
| Constructor Detail |
|---|
public HibernateItemWriter()
| Method Detail |
|---|
public void setClearSession(boolean clearSession)
clearSession - the flag value to setpublic void setHibernateTemplate(org.springframework.orm.hibernate3.HibernateOperations hibernateTemplate)
HibernateOperations property.
hibernateTemplate - the hibernateTemplate to setpublic final void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
setHibernateTemplate(org.springframework.orm.hibernate3.HibernateOperations)public void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanpublic final void write(java.util.List<? extends T> items)
write in interface ItemWriter<T>ItemWriter.write(java.util.List)
protected void doWrite(org.springframework.orm.hibernate3.HibernateOperations hibernateTemplate,
java.util.List<? extends T> items)
hibernateTemplate - the HibernateTemplate to use for the operationitems - the list of items to use for the write
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||