Try changing your included sql fragment to this:
<sql id="insertErreurObjet_fragment">
insert into FUN_ERR_OBJ (
numObj, codGi, numLang,
codInf, typErrObj, libErrObj
) values (
#numObj:INTEGER#, #codGi:VARCHAR#, #numLang:INTEGER#,
#codInf:VARCHAR#, #typErrObj:VARCHAR#, #libErrObj:VARCHAR#
)
</sql>
I think if you look in your db, you'll find a row with a null or 0
value for numErrObj, you are trying to insert another with the same id
value. By removing it from the insert, you should be OK.
Larry
On 10/11/05, Olivier Ziller GMail Lists <[EMAIL PROTECTED]> wrote:
> 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
>
>