ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Glezen <pgle...@us.ibm.com>
Subject Re: selectKey with Oracle (resolved)
Date Sat, 20 Aug 2005 01:58:40 GMT





Being Oracle-challanged myself, I approached my friendly DBA with the
problem.  I was told that a different function call was used for the same
purposed and called after the insert.  Perhaps each Oracle shop has their
own such function.  So I modified the name and flipped the order of my
insert statement and key like this.

<insert id="addProduct" parameterClass="xyz.ProductEntityBean">
   insert into mrt_product (COMPANY_ID, DIVISION_ID, UPC_NO)
            values (#companyId#, #divisionId#, #upcNo#)
  <selectKey keyProperty="uniqueProductId" resultClass="long">
     select pkg_sequence.f_read_sequence_value() as id from dual
  </selectKey>
</insert>

After my call to addProduct, my object has the uniqueProductId field
populated.

Paul
Mime
View raw message