Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 9000 invoked from network); 19 Mar 2006 04:40:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Mar 2006 04:40:57 -0000 Received: (qmail 99054 invoked by uid 500); 19 Mar 2006 04:40:55 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 99039 invoked by uid 500); 19 Mar 2006 04:40:55 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 99028 invoked by uid 99); 19 Mar 2006 04:40:55 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Mar 2006 20:40:55 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of ericblue76@gmail.com designates 64.233.166.183 as permitted sender) Received: from [64.233.166.183] (HELO pproxy.gmail.com) (64.233.166.183) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Mar 2006 20:40:54 -0800 Received: by pproxy.gmail.com with SMTP id s49so1332537pyc for ; Sat, 18 Mar 2006 20:40:33 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=VaA6Z0ic3MJFTfbDLOvIp7qzJNcfPPdB8Mq0C0Ffv1kSezEUS5eMtBNKb78OmOGV7gil3UuiKyGnIv0UcEnM50cwt6xpTQ4wGVMU6pIXk/vEJVNrf6x8VtU21rSttqTIgvqjcuhEuRxrJZmcsEc+nyHIzu+ls81OkiARwgBx/FU= Received: by 10.35.96.11 with SMTP id y11mr1343514pyl; Sat, 18 Mar 2006 20:40:33 -0800 (PST) Received: by 10.35.31.12 with HTTP; Sat, 18 Mar 2006 20:40:33 -0800 (PST) Message-ID: <295517f10603182040r774ddd14i678ef5062ff5cb61@mail.gmail.com> Date: Sat, 18 Mar 2006 20:40:33 -0800 From: "Eric T. Blue" To: user-java@ibatis.apache.org Subject: Re: Oracle insert - selectKey problem In-Reply-To: <441cdcc1.0dc092cb.319e.ffffed14@mx.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4277_3375236.1142743233566" References: <441cdcc1.0dc092cb.319e.ffffed14@mx.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_4277_3375236.1142743233566 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 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 i= n > inserting the person. > > > > Target Database is Oracle 9.2 > > iBatis Version 2.1.7 - Jan 21, 2006 > > > > > > > > > > > > select SEQ_PERSON.nextval as seqId from dual > > > > INSERT INTO PERSON_TBL ( personId, name, age,gender) VALUES > (#seqId#, #name#, #age#, #gender#) > > > > > > Error message is: > > > > > > > ------=_Part_4277_3375236.1142743233566 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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/0= 6, 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 t= hat was used in inserting the person.

 

Target Database is Oracle 9.2

iBatis Version 2.1.7 - Jan 21, 2006

 

 

 

    <insert id=3D"savePerson"=
;  parameterClass=3D"PersonObject" resultClass=3D"int"
>
     &=
nbsp;      <selectKey  property=3D"pe=
rsonId" type=3D"pre"  resultClass=3D
"int">

         &nbs= p;         select SEQ_PERSON.nextval as seqId from dual

          <= ;/selectKey>

        INSERT INTO PER= SON_TBL ( personId, name, age,gender) VALUES (#seqId#, #name#, #age#, #gender#)

    </insert> 

 

Error message is:

 

 

 


------=_Part_4277_3375236.1142743233566--