oracle:
<insert id="insertLog" parameterClass="Log">
<![CDATA[
INSERT INTO LOG (ID, USERID, DOCID, RESULT, INVOKETIME, ENDTIME)
VALUES (CMDB_SEQ.NEXTVAL, #userId#, #docId#, #result#,#invokeTime#, #endTime#)
]]>
<selectKey resultClass="int" keyProperty="id" >
SELECT CMDB_SEQ.CURVAL FROM DUAL
</selectKey>
</insert>
DB2:
<selectKey resultClass="int" keyProperty="TREE_ID" >
SELECT IDENTITY_VAL_LOCAL() as TREE_ID FROM SYS.TREE
</selectKey>
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 id="insertLog" parameterClass="Log">
<![CDATA[
INSERT INTO LOG (ID, USERID, DOCID, RESULT, INVOKETIME, ENDTIME)
VALUES (CMDB_SEQ.NEXTVAL, #userId#, #docId#, #result#,#invokeTime#, #endTime#)
]]>
<selectKey resultClass="int" keyProperty="id" >
SELECT CMDB_SEQ.CURVAL FROM DUAL
</selectKey>
</insert>
DB2:
<selectKey resultClass="int" keyProperty="TREE_ID" >
SELECT IDENTITY_VAL_LOCAL() as TREE_ID FROM SYS.TREE
</selectKey>
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