All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jobs.hibernateJob.xml Maven / Gradle / Ivy

The newest version!
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

	<description>Example for Hibernate integration.</description>

	<bean id="hibernateJob" parent="simpleJob">
		<!-- set restartable=false so that this job can be used by more than one test -->
		<property name="restartable" value="false" />
		<property name="steps">
			<bean id="step1" parent="skipLimitStep">
				<property name="skipLimit" value="5" />
				<property name="itemReader" ref="hibernateItemReader" />
				<property name="itemWriter" ref="hibernateItemWriter" />
				<property name="commitInterval" value="3" />
			</bean>
		</property>
	</bean>


	<!-- This is a framework class that needs a delegate and also needs to be registered as a RepeatInterceptor in the chunk -->
	<bean id="hibernateItemWriter"
		class="org.springframework.batch.item.database.HibernateAwareItemWriter">
		<property name="sessionFactory" ref="sessionFactory" />
		<property name="delegate" ref="hibernateCreditWriter" />
	</bean>

	<bean id="hibernateCreditWriter"
		class="org.springframework.batch.sample.item.writer.CustomerCreditIncreaseWriter">
		<property name="customerCreditDao" ref="customerCreditDao" />
	</bean>

	<bean id="customerCreditDao"
		class="org.springframework.batch.sample.dao.HibernateCreditDao">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>

	<bean id="hibernateItemReader"
		class="org.springframework.batch.item.database.HibernateCursorItemReader">
		<property name="queryString" value="from CustomerCredit" />
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>

</beans>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy