Forums: Open Discussion (Thread #22535)

【バッチFW】トランザクション隔離レベルの変更 (2009-04-27 17:50 by Anonymous #43463)

お世話になります。
現在、バッチFWを使用したジョブを作成・活用しております。
詳細は省きますが、トランザクションの関係でファントムリードが発生し、データの整合性が合わない状態が発生しています。
使用データベースはPostgresQLでトランザクション隔離レベルをSERIALIZABLEにあげたいのですが設定変更は可能でしょうか?

Reply to #43463×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 【バッチFW】トランザクション隔離レベルの変更 (2009-04-27 19:23 by ahn #43473)

dataAccessContext-batch.xml内の設定を以下のように変更すれば対応することができます。

----------------------------------------------------------------------------
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="defaultTransactionIsolation" value="8"/><!-- SERIALIZABLE -->
</bean>

----------------------------------------------------------------------------
  READ_UNCOMMITTED = 1
  READ_COMMITTED = 2
  REPEATABLE_READ = 4
  SERIALIZABLE = 8
----------------------------------------------------------------------------
Reply to #43463

Reply to #43473×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 【バッチFW】トランザクション隔離レベルの変更 (2009-04-28 08:52 by Anonymous #43499)

早速のご回答ありがとうございました。
内容に沿って変更してみたいと思います。
尚、複数のDBに接続する使用で組み立てているのですが、参照・更新用DBだけでなく、それとは別に使用している参照用のみのDBでも上記の設定でSERIALIZABLEレベルになるのでしょうか?
Reply to #43463

Reply to #43499×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 【バッチFW】トランザクション隔離レベルの変更 (2009-04-28 09:52 by ahn #43500)

回答した設定方法はSpringが生成するデータソースのインスタンス毎の設定になります。
従って、使用するDB毎にデータソースを設定することができますので「参照用のみのDB」でも
SERIALIZABLEレベルに設定することができます。
複数DBの設定方法につきましては以下の記事をご参照ください。
<http://sourceforge.jp/forum/message.php?msg_id=41769>
ただし、複数DB設定はそれぞれのDBを別々に扱う設定であり、分散トランザクション制御
つまり複数DBを跨ったトランザクション制御を意味するものではありませんのでご注意下さい。
Reply to #43499

Reply to #43500×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 【バッチFW】トランザクション隔離レベルの変更 (2009-04-28 10:00 by Anonymous #43501)

2番目の質問の内容ですが、よく考えたらdataAccessContext-batch.xmlで複数DB定義する際に、それぞれで<property name="defaultTransactionIsolation" value="8"/>
のプロパティを設定すればよいだけのことですね。
間違いがある場合にはご指摘ください。
Reply to #43463

Reply to #43501×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 【バッチFW】トランザクション隔離レベルの変更 (2009-04-28 10:08 by Anonymous #43502)

すみません。43501のコメントは43500を確認しないうちに投稿してしまったものです。
内容は理解できました。
ありがとうございました。
Reply to #43463

Reply to #43502×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login