繁体   English   中英

在Spring Batch 3.0.x中-如何为非标准数据库设置数据库类型?

[英]In Spring Batch 3.0.x - How to set database type for Non-standard Database?

使用以前的xml格式,可以通过以下方式实现:-(1)

<value>classpath:batch-mysql.properties</value>

(2)

<bean id="jobRepository" class="org...JobRepositoryFactoryBean">
<property name="databaseType" value="mysql"/>
<property name="dataSource" ref="dataSource"/>

[参考: http//docs.spring.io/spring-batch/reference/html/configureJob.html]

我能够使用Spring Batch以前的格式xml处理数据库。 但是我坚持使用新的格式注释。 默认情况下,始终使用嵌入式hsql。

但是使用新格式(仅使用注释)如何设置数据库类型?

API文档中关于此的信息不多。

有人可以帮我吗? 谢谢。

在尝试了几件事之后。 想出一种方法来设置数据库类型(可能不是有效的方法)。 我在用 -

HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
jpaVendorAdapter.setDatabase(Database.MYSQL); 

这是工作。 我的代码在这里-http://github.com/sidnan/spring-batch-example 如果有人有更好的东西,请告诉我。 谢谢!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM