Spring Batch 不支持我的数据库 Sap Hana db。我正在寻找有关如何为 SpringBatch 的 SimpleJobRepository 实现我自己的 DAO 的指南。以前试过这个吗?
我没有包含数据库类型属性,因为根据 Spring Batch 网站不包含它会自动搜索数据库类型。我还使用了 JobRepositoryFactoryBean 因为数据库不受支持。
我很高兴为此编写自己的实现,也许我可以将它贡献给 spring 批处理源。
我的设置如下:
<bean id="jobRepository"
class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="transactionManager" ref="transactionManager" />
<property name="isolationLevelForCreate" value="ISOLATION_DEFAULT" />
<property name="validateTransactionState" value="false"/>
</bean>
目前我收到以下错误:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobRepository' defined in ServletContext resource [/WEB-INF/batch-context.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: DatabaseType not found for product name: [HDB]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:323)
... 59 more
Caused by: java.lang.IllegalArgumentException: DatabaseType not found for product name: [HDB]
at org.springframework.batch.support.DatabaseType.fromProductName(DatabaseType.java:79)
at org.springframework.batch.support.DatabaseType.fromMetaData(DatabaseType.java:110)
at org.springframework.batch.core.repository.support.JobRepositoryFactoryBean.afterPropertiesSet(JobRepositoryFactoryBean.java:182)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
... 66 more