The order of selectKey tag is important. Below is right, but if selectKey tag located just after insert tag, it can out get index id.

 <insert id="insertUserDefinedURLData" parameterClass="UserDefinedURLData">
  INSERT INTO userdefine_url
   (projectname, url, expected, charset, sms, mail, name, companyID, precallURL)
  VALUES
   (#projectName#, #url#, #expected#, #charset#, #sms#, #mail#, #name#, #companyID#, #precallURL#)
   <selectKey keyProperty="id" resultClass="int">
            SELECT LAST_INSERT_ID()
        </selectKey>  

 </insert>
Posted by 김용환 '김용환'

댓글을 달아 주세요