For me it works like this (mybatis 3)
<insert id="create" parameterType="Project" useGeneratedKeys="true" keyProperty="project.projectId" keyColumn="PROJECT_ID"> INSERT INTO PROJECT (TITLE,DESCRIPTION) VALUES (#{title},#{description}) </insert>
No need for selectKey. Just believe the correct value in keyProperty .. I have a trigger before inserting into oracle to get the next identifier from the sequence.
Alternatively, this also works:
<insert id="createEmpty" statementType="CALLABLE" parameterType="Panelist"> BEGIN INSERT INTO PANELIST(PANEL_ID) VALUES (#{panelId}) RETURNING PANELIST_ID INTO #{panelist.panelistId,mode=OUT,jdbcType=INTEGER}; END; </insert>
source share