Apache iBatis에서 MSSQL DB에 Insert시에 리턴값을 받아오는 형태입니다.
1. 코드
int key = (int)sqlMap.Insert("InsertOrganization", organization);
2. xml 내용
1. 코드
int key = (int)sqlMap.Insert("InsertOrganization", organization);
2. xml 내용
<insert id="InsertOrganization" parameterClass="Organization" resultClass="int">
<selectKey property="Id" type="post" resultClass="int">
SELECT @@IDENTITY AS value
</selectKey>
INSERT INTO Organizations
(Org_Code, Org_Name)
VALUES
(#Code#, #Name#)
</insert>
'Apache Project > Ibatis/Mybatis' 카테고리의 다른 글
| mssql 2008 jdbc 세팅하기.. (0) | 2010/06/11 |
|---|---|
| Apache iBatis에서 다중 데이터 베이스 사용 방법 (0) | 2008/08/01 |
| IBatis에서 MSSQL의 여러개 카탈로그에 접속하기 (0) | 2008/06/10 |
| iBatis에서 MSSQL의 Insert문의 리턴 값 가져오기 (0) | 2008/05/27 |
| DBCP와 iBatis를 통한 Connection Pooling 사용기 (0) | 2008/02/14 |