$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> id NOT NULL AUTO_INCREMENT,<br> name VARCHAR(45) NOT NULL,
<br> PRIMARY KEY(id)<br>};<br><br>//$B%(%s%F%#%F%#(B<br>@Bean(table = "dry")<br>public class Dry implements Serializable{<br> Integer id;<br> String name;<br> @Id(IdType.IDENTITY)<br> public Integer getId(){
<br> return id;<br> }<br> public void setId(Integer id){<br> <a href="http://this.id">this.id</a> = id;<br> }<br> public String getName(){<br> return name;<br> }<br> public void setName(String name){
<br> <a href="http://this.name">this.name</a> = name;<br> }<br><br clear="all">//DAO<br>@S2Dao(bean=Dry.class)<br>public interface DryDao{<br> void insert(Dry dry);<br>}<br><br>//$B%/%i%$%"%s%H(B<br>public class DryMain{
<br> private static final String PATH = "app.dicon";<br> public static void main(String[] args){<br> S2Container container = S2ContainerFactory.create(PATH);<br> Dry dry = new Dry("Super");
<br> DryDao dao = (DryDao)container.getComponent(DryDao.class);<br> dao.insert(dry);<br> System.out.println(dry.getId());//$B<+F0@8@.$7$?CM$,F~$C$F$$$F$[$7$$!#(B<br> }<br>}<br><br>//app.dicon<br><?xml version="
1.0" encoding="UTF-8"?><br><!DOCTYPE components PUBLIC "-//SEASAR//DTD S2Container 2.3//EN"<br> "<a href="http://www.seasar.org/dtd/components23.dtd">http://www.seasar.org/dtd/components23.dtd
</a>"><br><components><br> <include path="j2ee.dicon"/><br> <include path="dao.dicon"/><br> <component class="samples.DryDao"><br> <aspect>
dao.interceptor</aspect><br> </component><br></components><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>)