ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <lmead...@apache.org>
Subject Re: select key and insert with failure
Date Mon, 03 Sep 2007 21:47:29 GMT
This should be fixed in SVN now - if you want to try it, you can check
it out and build it.

Larry


On 9/3/07, Lott, Neil <neil.lott@twcable.com> wrote:
>
> If I have a selectKey pre within an insert statement that I have working:
>
>
>
> <parameterMap id="create-cast-param" class="castBean">
>
>       <parameter property="firstName" jdbcType="VARCHAR"
> javaType="java.lang.String"/>
>
>       <parameter property="lastName" jdbcType="VARCHAR"
> javaType="java.lang.String"/>
>
>       <parameter property="bio" jdbcType="VARCHAR"
> javaType="java.lang.String"/>
>
>       <parameter property="actorID" jdbcType="NUMERIC"
> javaType="java.lang.Integer"/>
>
>    </parameterMap>
>
>
>
>    <insert id="createCastMember"
> parameterMap="create-cast-param">
>
>       insert into OD_ACTOR
>
>       (
>
>          ACTOR_FIRST_NAME, ACTOR_LAST_NAME, ACTOR_BIO,
>
>          OD_ACTOR_ID
>
>       ) values (
>
>          ?, ?, ?,
>
>          ?
>
>       )
>
>
>
>       <selectKey resultClass="int" keyProperty="actorID" type="pre">
>
>          select OD_ACTOR_ID_SEQ.NEXTVAL from dual
>
>       </selectKey>
>
>    </insert>
>
>
>
> Let's say my insert fails, then the select key will still populate the
> actorID in my castBean.  Is there a way for this value not to be populated
> if the insert fails?

Mime
View raw message