$B$*@$OC$K$J$C$F$$$^$9!#(Bmasapon1967$B$H$$$$$^$9!#(B<br><br>$B<+F0@8@.$9$k$h$&$K$7$?%U%#!<%k%I$r$b$D%*%V%8%'%/%H$r(BS2Dao$B$r;HMQ$7$FA^F~$7$?D>8e$K(B<br>$B$=$N%*%V%8%'%/%H$N%U%#!<%k%I$r3NG'$9$k$H(B0$B$,BeF~$5$l$F$$$^$9!#(B<br>$B%G!<%?%Y!<%9$K$O@5$7$/%l%3!<%I$,A^F~$5$l$F$$$^$7$?!#(B<br>$B$3$l$O;EMM$G$7$g$&$+!#$b$7$=$&$G$O$J$$>l9g$O!"$I$N$h$&$K$7$F<+F0@8@.$7$?CM$r(B<br>$BBeF~$9$k$N$G$7$g$&$+!#(B<br><br>$B2a5n$N%m%0$G!"(B#3439$B$N(BG$BMM$,:n@.$7$?8!>ZMQ%W%m%0%i%`$G$OA^F~D>8e$KA^F~$7$?(B
<br>$B%*%V%8%'%/%H$N(BID$B$K<+F0@8@.$7$?CM$,BeF~$5$l$F$$$k$h$&$G$9!#(B<br><br>$B4D6-(B<br>Seasar2 2.3.12<br>S2Dao 1.0.35<br>MySQL 5.0.24a<br>MySQL Connector/J 5.0.3<br><br>//$B%F!<%V%kDj5A(B<br>CREATE TABLE dry<br>{<br>&nbsp;&nbsp;  id NOT NULL AUTO_INCREMENT,<br>&nbsp; &nbsp; name VARCHAR(45) NOT NULL,
<br>&nbsp; &nbsp; PRIMARY KEY(id)<br>};<br><br>//$B%(%s%F%#%F%#(B<br>@Bean(table = &quot;dry&quot;)<br>public class Dry implements Serializable{<br>&nbsp; &nbsp; Integer id;<br>&nbsp; &nbsp; String name;<br>&nbsp; &nbsp; @Id(IdType.IDENTITY)<br>&nbsp; &nbsp; public Integer getId(){
<br>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; return id;<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; public void setId(Integer id){<br>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; <a href="http://this.id">this.id</a> = id;<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; public String getName(){<br>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; return name;<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; public void setName(String name){
<br>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; <a href="http://this.name">this.name</a> = name;<br>&nbsp; &nbsp; }<br><br clear="all">//DAO<br>@S2Dao(bean=Dry.class)<br>public interface DryDao{<br>&nbsp; &nbsp; void insert(Dry dry);<br>}<br><br>//$B%/%i%$%"%s%H(B<br>public class DryMain{
<br>&nbsp; &nbsp; private static final String PATH = &quot;app.dicon&quot;;<br>&nbsp; &nbsp; public static void main(String[] args){<br>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; S2Container container = S2ContainerFactory.create(PATH);<br>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; Dry dry = new Dry(&quot;Super&quot;);
<br>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; DryDao dao = (DryDao)container.getComponent(DryDao.class);<br>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; dao.insert(dry);<br>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; System.out.println(dry.getId());//$B<+F0@8@.$7$?CM$,F~$C$F$$$F$[$7$$!#(B<br>&nbsp; &nbsp; }<br>}<br><br>//app.dicon<br>&lt;?xml version=&quot;
1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;!DOCTYPE components PUBLIC &quot;-//SEASAR//DTD S2Container 2.3//EN&quot;<br>&nbsp;&nbsp;&nbsp; &quot;<a href="http://www.seasar.org/dtd/components23.dtd">http://www.seasar.org/dtd/components23.dtd
</a>&quot;&gt;<br>&lt;components&gt;<br>&nbsp;&nbsp;&nbsp; &lt;include path=&quot;j2ee.dicon&quot;/&gt;<br>&nbsp;&nbsp;&nbsp; &lt;include path=&quot;dao.dicon&quot;/&gt;<br>&nbsp;&nbsp;&nbsp; &lt;component class=&quot;samples.DryDao&quot;&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;aspect&gt;
dao.interceptor&lt;/aspect&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/component&gt;<br>&lt;/components&gt;<br><br>$BI8=`=PNO(B<br>DEBUG 2006-10-11 11:23:17,436 [main] $BJ*M}E*$J%3%M%/%7%g%s$r<hF@$7$^$7$?(B<br>DEBUG 2006-10-11 11:23:17,436 [main] $BO@M}E*$J%3%M%/%7%g%s$r<hF@$7$^$7$?(B<br>DEBUG 2006-10-11 11:23:17,757 [main] $BO@M}E*$J%3%M%/%7%g%s$rJD$8$^$7$?(B
<br>DEBUG 2006-10-11 11:23:17,807 [main] $BO@M}E*$J%3%M%/%7%g%s$r<hF@$7$^$7$?(B<br>DEBUG 2006-10-11 11:23:17,817 [main] INSERT INTO dry (name) VALUES ('Super')<br>DEBUG 2006-10-11 11:23:17,947 [main] SELECT LAST_INSERT_ID()<br>DEBUG 2006-10-11 11:23:18,167 [main] $BJ*M}E*$J%3%M%/%7%g%s$r<hF@$7$^$7$?(B
<br>DEBUG 2006-10-11 11:23:18,167 [main] $BO@M}E*$J%3%M%/%7%g%s$r<hF@$7$^$7$?(B<br>DEBUG 2006-10-11 11:23:18,187 [main] $BO@M}E*$J%3%M%/%7%g%s$rJD$8$^$7$?(B<br>DEBUG 2006-10-11 11:23:18,187 [main] $BO@M}E*$J%3%M%/%7%g%s$rJD$8$^$7$?(B<br>0<br><br>-- <br>----------------------------------------------
<br>Masakazu Kobayashi (<a href="mailto:masapon1967@gmail.com">masapon1967@gmail.com</a>)