[Seasar-user:16653] Re: 【 S2Dao 】更新処理の前後に共通の DB アクセス処理を追加する方法について
[E-MAIL ADDRESS DELETED]
[E-MAIL ADDRESS DELETED]
2009年 1月 12日 (月) 22:28:54 JST
$B$R$,MM(B
$B$*@$OC$K$J$C$F$*$j$^$9!#(B
$BC+8}$G$9!#(B
>$BLdBj$H$$$&$N$,!"$I$&$$$&$b$N$@$+$o$+$i$J$$$N$G$9$,!"(B
>$B:#2s:n$m$&$H$7$F$$$k%$%s%?!<%;%W%?$,(BS2Dao$B$N%$%s%?!<%;%W%?$h$j(B
>$[E-MAIL ADDRESS DELETED]$KDj5A$5$l$F$$$l$P!"Bg>fIW$J$O$:$G$9!#(B
$B2<5-$N$h$&$K%$%s%?!<%;%W%?$+$i%"%9%Z%/%HBP>]$N(B
$B%$%s%9%?%s%9$r<hF@$7!"(BDB$B8!:w%a%=%C%I$r<B9T$9$k$h$&$K$7$?$H$3$m!"(B
$B-"$N99?7=hM}$NA0$K!"F10l$N(BDao$B$N-!$N8!:w=hM}$r(B
$BF0:n$5$;$k$3$H$,$G$-$^$7$?!#$"$j$,$H$&$4$6$$$^$9!#(B
-----
public Object invoke(MethodInvocation invocation) throws Throwable {
Object obj;
if (invocation.getThis() instanceof TestDao) {
// $B99?7A0>pJs$r<hF@(B
TestDao dao = (TestDao)invocation.getThis();
List<TestEntity> result =
dao.selectTestTb((TestEntity)invocation.getArguments()[0]);$B!!!&!&!&!&-!(B
$B!!!!!!!!!!!!!ACfN,!A(B
// $B99?7=hM}$r<B9T(B
obj = invocation.proceed();$B!!!&!&!&!&-"(B
// TODO $B99?78e>pJs$r<hF@(B
$B!!!!!!!!!!!!!ACfN,!A(B
} else {
throw new RuntimeException("$BEPO?$5$l$F$$$J$$(BDAO$B%/%i%9$G$9(B");
}
// TODO $B%m%0EPO?=hM}$r<B9T(B
$B!!!!!!!!!!!!!ACfN,!A(B
return obj;
}
}
-----
$B$?$@!"$3$A$i$N;EMM$NLdBj$G!"3F(BDao$B$N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aming$B$[E-MAIL ADDRESS DELETED]@.$7$F$$$^$9!#(B)
> >
> > $BA4$F$N(BDAO$B%$%s%?%U%'!<%9$N(Bupdate$B%a%=%C%I$NA08e$K(B
> > $B6&DL=hM}$H$7$FF~$l9~$_$?$$$H9M$(!"(B
> > DAO$BMQ$N%$%s%?!<%;%W%?$rMQ0U$7$?$N$G$9$,!"(B
> > $BB?!9LdBj$,H/@8$7$&$^$/9T$-$^$;$s$G$7$?!#(B
> >
> $BLdBj$H$$$&$N$,!"$I$&$$$&$b$N$@$+$o$+$i$J$$$N$G$9$,!"(B
> $B:#2s:n$m$&$H$7$F$$$k%$%s%?!<%;%W%?$,(BS2Dao$B$N%$%s%?!<%;%W%?$h$j(B
> $[E-MAIL ADDRESS DELETED]$KDj5A$5$l$F$$$l$P!"Bg>fIW$J$O$:$G$9!#(B
>
> > $B$=$b$=$b$3$N%$%s%?!<%;%W%?$rMQ0U$9$k(B
> > $B<BAuJ}<0$[E-MAIL ADDRESS DELETED]$7$$$+$b$h$/$o$+$C$F$*$j$^$;$s!#(B
> >
> > $BDL>o!"(BS2Dao$B$N%a%=%C%I<B9TA08e$K6&DL=hM}$H$7$F(B
> > DB$B%"%/%;%9=hM}$rF~$l$?$$>l9g!"$I$N$h$&$K<BAu$9$l$P$h$$$N$G$7$g$&$+(B
> > $B$465<x$$$?$@$1$k$H=u$+$j$^$9!#(B
> >
> $B>e5-$N$h$&$J;EMM$J$i!"(BRDBMS$B$N%H%j%,$G$d$C$?$[$&$,NI$$$+$b$7$l$^$;$s!#(B
>
> $B$h$m$7$/$*4j$$$7$^$9!#(B
> _______________________________________________
> Seasar-user mailing list
> [E-MAIL ADDRESS DELETED]
> https://ml.seasar.org/mailman/listinfo/seasar-user
>
Seasar-user メーリングリストの案内