AKAI TSUKI

System development or Technical something

トランザクションを管理する

下ような感じでUserTransactionクラスを利用することで
トランザクションの管理できそう。

    private UserTransaction ut_ = null;

    public void initialize()
    {
        // コンテナの初期化
        this.container_ = S2ContainerFactory.create(this.path_);
        this.container_.init();
        
        this.ut_ = (UserTransaction)this.container_.getComponent("UserTransaction");
        
        this.dao_ = (SampleInfoDao)this.container_.getComponent("SampleInfoDao");

    }

トランザクションのログが出た

System start
DEBUG 2011-02-17 03:45:01,318 [main] S2Containerを作成します。path=jp/person/akai/tsuki/samplechecker/dicon/alldao.dicon
DEBUG 2011-02-17 03:45:01,417 [main] S2Containerを作成します。path=dao.dicon
DEBUG 2011-02-17 03:45:01,441 [main] S2Containerを作成します。path=j2ee.dicon
DEBUG 2011-02-17 03:45:01,449 [main] S2Containerを作成します。path=jta.dicon
DEBUG 2011-02-17 03:45:01,565 [main] S2Containerを作成しました。path=jta.dicon
DEBUG 2011-02-17 03:45:01,565 [main] S2Containerを作成します。path=jdbc.dicon
DEBUG 2011-02-17 03:45:01,629 [main] S2Containerを作成します。path=jdbc-extension.dicon
DEBUG 2011-02-17 03:45:01,636 [main] S2Containerを作成します。path=convention.dicon
DEBUG 2011-02-17 03:45:01,684 [main] S2Containerを作成しました。path=convention.dicon
DEBUG 2011-02-17 03:45:01,695 [main] S2Containerを作成しました。path=jdbc-extension.dicon
DEBUG 2011-02-17 03:45:01,746 [main] S2Containerを作成しました。path=jdbc.dicon
DEBUG 2011-02-17 03:45:01,761 [main] S2Containerを作成しました。path=j2ee.dicon
DEBUG 2011-02-17 03:45:01,821 [main] S2Containerを作成しました。path=dao.dicon
DEBUG 2011-02-17 03:45:01,821 [main] S2Containerを作成します。path=aop.dicon
DEBUG 2011-02-17 03:45:01,862 [main] S2Containerを作成しました。path=aop.dicon
DEBUG 2011-02-17 03:45:01,876 [main] S2Containerを作成しました。path=jp/person/akai/tsuki/samplechecker/dicon/alldao.dicon
DEBUG 2011-02-17 03:45:02,247 [main] トランザクションを開始しました。tx=[FormatId=4360, GlobalId=1297881902246/0, BranchId=]
DEBUG 2011-02-17 03:45:02,247 [main] BEGIN jp.person.akai.tsuki.samplechecker.dao.SampleInfoDao#update([/checkNumber=29189/sendTime=null/recvTime=null/resendTime=500/resendCounter=15])
DEBUG 2011-02-17 03:45:02,502 [main] 物理的なコネクションを取得しました
DEBUG 2011-02-17 03:45:02,504 [main] 論理的なコネクションを取得しました。tx=[FormatId=4360, GlobalId=1297881902246/0, BranchId=]
DEBUG 2011-02-17 03:45:02,529 [main] 論理的なコネクションを閉じました。tx=[FormatId=4360, GlobalId=1297881902246/0, BranchId=]
DEBUG 2011-02-17 03:45:02,530 [main] 論理的なコネクションを取得しました。tx=[FormatId=4360, GlobalId=1297881902246/0, BranchId=]
DEBUG 2011-02-17 03:45:02,602 [main] 論理的なコネクションを閉じました。tx=[FormatId=4360, GlobalId=1297881902246/0, BranchId=]
DEBUG 2011-02-17 03:45:02,688 [main] 論理的なコネクションを取得しました。tx=[FormatId=4360, GlobalId=1297881902246/0, BranchId=]
DEBUG 2011-02-17 03:45:02,689 [main] 論理的なコネクションを閉じました。tx=[FormatId=4360, GlobalId=1297881902246/0, BranchId=]
DEBUG 2011-02-17 03:45:02,697 [main] 論理的なコネクションを取得しました。tx=[FormatId=4360, GlobalId=1297881902246/0, BranchId=]
DEBUG 2011-02-17 03:45:02,702 [main] UPDATE "SAMPLE_INFO" SET "RESEND_TIME" = 500, "SEND_TIME" = null, "RECV_TIME" = null, "RESEND_COUNTER" = 15 WHERE "CHECK_NUMBER" = '29189'
DEBUG 2011-02-17 03:45:02,745 [main] 論理的なコネクションを閉じました。tx=[FormatId=4360, GlobalId=1297881902246/0, BranchId=]
DEBUG 2011-02-17 03:45:02,746 [main] END jp.person.akai.tsuki.samplechecker.dao.SampleInfoDao#update([/checkNumber=29189/sendTime=null/recvTime=null/resendTime=500/resendCounter=15]) : 1
DEBUG 2011-02-17 03:45:02,756 [main] トランザクションをコミットしました。tx=[FormatId=4360, GlobalId=1297881902246/0, BranchId=]
System stop