[Seasar-user:15353] Intercepterでのトランザクション処理

IZUNO Tadashi [E-MAIL ADDRESS DELETED]
2008年 8月 11日 (月) 20:01:32 JST


$B$$$E$N$G$9!#(B


$B0J2<$N$h$&$J(Bintercepter$B$G(BJdbcManager$B$r;H$C$F%G!<%?%Y!<%9$N99?7=hM}$r$7$F$$$k$N$G$9$,!"(B
intercepter$B$K%H%i%s%6%/%7%g%s@)8f$rE,MQ$9$kJ}K!$K$D$$$F65$($F$/$@$5$$!#(B

public Object invoke(final MethodInvocation invocation) throws Throwable {
    Object ret = null;
    Throwable cause = null;
    try {
        ret = invocation.proceed();
    } catch (final Throwable t) {
        cause = t;
    } finally {
        jdbcManager.insert(entity).execute();
    }
    if (cause == null) {
        return ret;
    }
    throw cause;
}

invocation$B$H$O%H%i%s%6%/%7%g%s$rJL$1$?$$$N$G$9$,(Bdicon$B$J$I$G$[E-MAIL ADDRESS DELETED]$G$[E-MAIL ADDRESS DELETED];EJ}$,A4$/;W$$Ib$+$P$:!"0J2<$NJ}K!$0$i$$$7$+;W$$$D$-$^$;$s$G$7$?!#(B
$B-!(Binsert$B=hM}ItJ,$r(Bpublic$B%a%=%C%I$H$7$FCj=P$7!"([E-MAIL ADDRESS DELETED]("j2ee.requiredTx")$B$J%"%N%F!<%7%g%s$[E-MAIL ADDRESS DELETED]$9$k!#(B
$B-"(Biintercepter$B$K(BUserTranzaction$B$r(BDI$B$7$F!"(Bbegin()$B!"(Bcommit()$B!"(Brollback()$B$r<+$iH/9T$9$k!#(B

$B-!$O(Bpublic$B%a%=%C%I$K$J$C$F$7$^$&$N$G$^$:$$$+$J$H;W$C$F$$$^$9!#(B

$B>e<j$J$d$jJ}$OL5$$$b$N$G$7$g$&$+!)!)(B


Seasar-user メーリングリストの案内