ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric T. Blue" <ericblu...@gmail.com>
Subject Re: Oracle insert - selectKey problem
Date Sun, 19 Mar 2006 04:40:33 GMT
Hi,

I believe your selectkey property name must match the #property# you are
using for the insert statement.  So, you can either replace #seqId# with
#personId#, or rename the selectKey property to seqId.  Also, I'm not
certain if this has changed, but in the past when I've used selectKey the
attribute for naming the key is keyProperty not property.

On 3/18/06, Shardayyy <shardayyy@gmail.com> wrote:
>
>  Hey folks,
>
>
>
>
>
> I am having a problem getting this to work. Any help would be appreciated.
> What am trying to do is insert a person and return the Id that was used in
> inserting the person.
>
>
>
> Target Database is Oracle 9.2
>
> iBatis Version 2.1.7 - Jan 21, 2006
>
>
>
>
>
>
>
>     <insert id="savePerson"  parameterClass="PersonObject" resultClass="int">
>
>             <selectKey  property="personId" type="pre"  resultClass="int">
>
>                    select SEQ_PERSON.nextval as seqId from dual
>
>           </selectKey>
>
>         INSERT INTO PERSON_TBL ( personId, name, age,gender) VALUES
> (#seqId#, #name#, #age#, #gender#)
>
>     </insert>
>
>
>
> Error message is:
>
>
>
>
>
>
>

Mime
View raw message