spring - 春季批处理分布式事务配置 IBM Liberty
问题描述
我必须配置 Spring Batch 才能在 IBM Liberty AS 中工作。主要问题是事务的配置。我的一些配置。
在 Liberty server.xml 文件中:
<dataSource id="ectxDS"
jndiName="jdbc/ectxDS"
isolationLevel="TRANSACTION_SERIALIZABLE"
transactional="true">
<jdbcDriver libraryRef="OracleLib"/>
<properties.oracle URL="jdbc:oracle:thin:..."
password="..."
user="..."/>
</dataSource>
在 Spring context.xml 中:
<!-- *** DATASOURCE *** -->
<jee:jndi-lookup id="dataSource"
jndi-name="jdbc/ectxDS"
expected-type="javax.sql.DataSource" />
<!-- *** JDBC TEMPLATE *** -->
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<constructor-arg name="dataSource" ref="dataSource" />
</bean>
<!-- *** TX MANAGER *** -->
<bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager">
</bean>
使用此配置,在调用 JdbcTemplate 类的方法(更新、查询...)时会发生提交:我需要 Spring Batch 根据其默认值管理事务,例如Tasklet的执行方法必须是事务性的!同时,我需要利用类org.springframework.transaction.jta.WebSphereUowTransactionManager使用分布式事务。
也许我错过了一些东西:我使用 Spring Batch 的时间很短。
先感谢您。
解决方案
推荐阅读
- ruby-on-rails - 为什么我在将 User 对象传递给 Notification 模型时收到 ActiveRecord::AssociationTypeMismatch?
- python - 如何获取列表并将其放入表单下拉列表
- javascript - 如何使用js将新标签添加到jquery对话框中?
- python - 这个优化问题有什么问题?我不断收到:ValueError:使用序列设置数组元素
- r - 闪亮的仪表板字符滑块输入
- php - 在依赖注入中的实现之间交替
- java - 有没有更好的方法来通过对对象数组执行碰撞检测?
- java - Spring Boot 禁用 Redis 服务器
- svg - svg 动画标记结束/标记开始与曲线路径动画
- python - 两个 Python venv 环境之间的联系在哪里