My main job does only read operations and the other one does some writing but on MyISAM engine
which ignores transactions, so I wouldn\'t require necessarily tr
Assuming you have 2 data sources, one for spring batch metadata such as job details[lets say CONFIGDB] and other for your business data [lets say AppDB]:
Inject CONFIGDB into jobRepository, like this:
<bean id="jobRepository"
class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean">
<property name="transactionManager" ref="transactionManager" />
<property name="dataSource" ref="CONFIGDB" />
<property name="databaseType" value="db2" />
<property name="tablePrefix" value="CONFIGDB.BATCH_" />
</bean>
Now you can inject the AppDB dartasource into your DAO's OR Writers if any like..
<bean id="DemoItemWriter" class="com.demoItemWriter">
<property name="dataSource" ref="AppDB" />
</bean>
OR
you can do define a resource and Inject this AppDB with jndi lookup in the class where its needed like:
public class ExampleDAO {
@Resource(lookup = "java:comp/env/jdbc/AppDB")
DataSource ds;
}