1. query xml
<insert id="insertSome" parameterClass="vo">
--query--
<selectKey keyProperty="seq(auto_increment column name)" resultClass="int">
SELECT LAST_INSERT_ID()
</selectKey>
</insert>
2. controller, service, service implement , dao -> void
2-1 controller
Vo vo = new VO();
vo.setSome("some value");
someservice.insertsome(vo);
2-2 service
void someservice(Vo vo) throws Exception;
2-3 service imple
@Override
void someservice(Vo vo) throws Exception{
someDAO.insertSome(vo);
}
2-4 dao
public void inserSome(Vo vo) throws Exception{
insert("id",vo);
}
3. result
controller
Vo vo = new VO();
vo.setSome("some value");
someservice.insertsome(vo); -> execute query
System.out.println(vo.getSeq()); -> returned key value