Class HibernateAwareCustomerCreditItemWriter
- java.lang.Object
- org.springframework.batch.sample.domain.trade.internal.HibernateAwareCustomerCreditItemWriter
- All Implemented Interfaces:
ItemWriter<CustomerCredit>
,org.springframework.beans.factory.InitializingBean
public class HibernateAwareCustomerCreditItemWriter extends java.lang.Object implements ItemWriter<CustomerCredit>, org.springframework.beans.factory.InitializingBean
Delegates writing to a custom DAO and flushes + clears hibernate session to fulfill theItemWriter
contract.- Author:
- Robert Kasanicky, Michael Minella
Constructor Summary
Constructors Constructor Description HibernateAwareCustomerCreditItemWriter()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
void
setDao(CustomerCreditDao dao)
void
setSessionFactory(org.hibernate.SessionFactory sessionFactory)
void
write(java.util.List<? extends CustomerCredit> items)
Process the supplied data element.
Method Detail
write
public void write(java.util.List<? extends CustomerCredit> items) throws java.lang.Exception
Description copied from interface:ItemWriter
Process the supplied data element. Will not be called with any null items in normal operation.- Specified by:
write
in interfaceItemWriter<CustomerCredit>
- Parameters:
items
- items to be written- Throws:
java.lang.Exception
- if there are errors. The framework will catch the exception and convert or rethrow it as appropriate.
setDao
public void setDao(CustomerCreditDao dao)
setSessionFactory
public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
java.lang.Exception