ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lott, Neil" <neil.l...@twcable.com>
Subject select key and insert with failure
Date Mon, 03 Sep 2007 21:40:26 GMT
 

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.

Mime
View raw message