u can use <selectKey> section
Cloudscape VALUES IDENTITY_VAL_LOCAL()
DB2 VALUES IDENTITY_VAL_LOCAL()
Derby VALUES IDENTITY_VAL_LOCAL()
HSQLDB CALL IDENTITY()
MySql SELECT LAST_INSERT_ID()
SqlServer SELECT SCOPE_IDENTITY()
SYBASE SELECT @@IDENTITY
ORACLE SELECT CUSTOM_SQL.NEXTVAL AS ID FROM DUAL
<!-- Insert example, using the Account parameter class -->
<insert id="InsertStaticForm" parameterClass="StaticForm">
insert into STATICFORM(
MENUID, TYPE, PATH, OUTERHEIGHT,
LINKURL, LINKTARGET, PARAM, PARAMVARIABLE, MAPHEADER,
MAPFOOTER, MAPSTYLE, TEXTFIELD)
values (
#menuid#, #type#, #path#, #outerheight#,
#linkurl#, #linktarget#, #param#, #paramvariable#,
#mapheader#, #mapfooter#, #mapstyle#, #textfield:java.lang.String#
)
<selectKey resultClass="int" keyProperty="id">
VALUES IDENTITY_VAL_LOCAL()
</selectKey>
</insert>
<!-- Update example, using the Account parameter class -->
<update id="UpdateStaticForm" parameterClass="StaticForm">
update STATICFORM set
TEXTFIELD = #textfield:java.lang.String#,
MENUID = #menuid#
TYPE = #type#,
PATH = #path#,
OUTERHEIGHT = #outerheight#,
LINKURL = #linkurl#,
LINKTARGET = #linktarget#,
PARAM = #param#,
PARAMVARIABLE = #paramvariable#,
MAPHEADER = #mapheader#,
MAPFOOTER = #mapfooter#,
MAPSTYLE = #mapstyle#
where
ID = #id#
</update>