Hi Larry,

Thanks for taking care of this.

Neil

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Larry Meadors
Sent: Monday, September 03, 2007 3:49 PM
To: user-java@ibatis.apache.org
Subject: Re: select key and insert with failure

I see his point, it's a pain to have it fail and then leave a mess to
clean up - no worries now, it'll be part of the next release. :-)

Larry


On 9/3/07, Nathan Maves <[EMAIL PROTECTED]> wrote:
> Well I am not sure why you would care but I would suggest that when
the
> insert fails, which should produce an exception, that you catch that
and
> then set the id field back to null.
>
> Nathan
>
>
>  On 9/3/07, Lott, Neil <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> >
> > Hello,
> >
> >
> >
> > 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?
> >
> >
> >
> > Thanks,
> >
> >
> >
> > Neil This E-mail and any of its attachments may contain Time Warner
> > Cable proprietary information, which is privileged, confidential,
> > or subject to copyright belonging to Time Warner Cable. This E-mail
> > is intended solely for the use of the individual or entity to which
> >
> > it is addressed. If you are not the intended recipient of this
> > E-mail, you are hereby notified that any dissemination,
> > distribution, copying, or action taken in relation to the contents
> > of and attachments to this E-mail is strictly prohibited and may be
> >
> > unlawful. If you have received this E-mail in error, please notify
> > the sender immediately and permanently delete the original and any
> > copy of this E-mail and any printout.
> >
> >
>
>
This E-mail and any of its attachments may contain Time Warner
Cable proprietary information, which is privileged, confidential,
or subject to copyright belonging to Time Warner Cable. This E-mail
is intended solely for the use of the individual or entity to which
it is addressed. If you are not the intended recipient of this
E-mail, you are hereby notified that any dissemination,
distribution, copying, or action taken in relation to the contents
of and attachments to this E-mail is strictly prohibited and may be
unlawful. If you have received this E-mail in error, please notify
the sender immediately and permanently delete the original and any
copy of this E-mail and any printout.

Reply via email to