ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Ziller GMail Lists <olivier.ziller.li...@gmail.com>
Subject Problem with include and selectKey
Date Tue, 11 Oct 2005 10:28:45 GMT
hello,

i've the following statements :

    <sql id="insertErreurObjet_fragment">

        insert into FUN_ERR_OBJ values (#numErrObj:INTEGER#, #numObj:INTEGER#, #codGi:VARCHAR#,
#numLang:INTEGER#, 

        #codInf:VARCHAR#, #typErrObj:VARCHAR#, #libErrObj:VARCHAR#)

    </sql> 


and

    <insert id="insertErreurObjet" 

        parameterClass="fr.unire.portal.channels.fun.csof.beans.ErreurObjet" >

         <include refid="insertErreurObjet_fragment"/>

        <!--

            insert into FUN_ERR_OBJ values (#numErrObj:INTEGER#, #numObj:INTEGER#, #codGi:VARCHAR#,
#numLang:INTEGER#, 

        #codInf:VARCHAR#, #typErrObj:VARCHAR#, #libErrObj:VARCHAR#)

        -->

        <selectKey keyProperty="numErrObj" resultClass="int">

            select LAST_INSERT_ID()

        </selectKey>

    </insert>

and i always get the following error :

Caused by: java.sql.SQLException: Duplicate key or integrity constraint violation message
from server


in the log file, it appears that the select LAS_INSERT_ID() is made 
_before_ the insert statements
it appears only if i use include.
if i comment my include and uncomment the insert into statement, it 
works, the LAST_INSERT_ID is made after the insert!

is it a bug or something i've made wrong?

thanks for any help


Mime
View raw message