Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 48414 invoked from network); 6 Apr 2007 15:58:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Apr 2007 15:58:55 -0000 Received: (qmail 37499 invoked by uid 500); 6 Apr 2007 15:59:00 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 37184 invoked by uid 500); 6 Apr 2007 15:58:59 -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 37173 invoked by uid 99); 6 Apr 2007 15:58:59 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Apr 2007 08:58:58 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of nathan.maves@gmail.com designates 64.233.184.233 as permitted sender) Received: from [64.233.184.233] (HELO wr-out-0506.google.com) (64.233.184.233) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Apr 2007 08:58:50 -0700 Received: by wr-out-0506.google.com with SMTP id 68so706618wri for ; Fri, 06 Apr 2007 08:58:29 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=ZmvF6p+YNE7gNS236vjZglKOwXjYW/4aWhBNLf6osYGPTNPZyhI3YFgjw1yDewJexScy6SW2f7NNtV3GOaz2F3KIFnozHLpfz15TN/QpRcxfx5nAFTt0UjoqiEkVyYBU1CJYdBcDW/u3fgwvomEOauFON56tsOaznnDjziSUD6M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=PeWo1OBzNHLTDLBQq+KVszSH63la0tG5duQ2jleCToOnniNv5AvvDYZPyTd49jrR5PEGsmlDm6KJIoEXyggRFObSdS7fAJcCyesExXtoQiHIXznusPY0wIkpBCPvDlFynxC0SIhyyW+daAJ8cbQyMFXzT7Q5W42+hJKGL2GAmDQ= Received: by 10.78.160.2 with SMTP id i2mr558360hue.1175875107309; Fri, 06 Apr 2007 08:58:27 -0700 (PDT) Received: by 10.78.35.9 with HTTP; Fri, 6 Apr 2007 08:58:27 -0700 (PDT) Message-ID: <2f55db670704060858k79cd5caau70d6bad625284e85@mail.gmail.com> Date: Fri, 6 Apr 2007 09:58:27 -0600 From: "Nathan Maves" To: user-java@ibatis.apache.org Subject: Re: insert sql and function calls. In-Reply-To: <14881030.1175804508928.JavaMail.root@eastrmwml04.mgt.cox.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_7151_30881613.1175875107056" References: <14881030.1175804508928.JavaMail.root@eastrmwml04.mgt.cox.net> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_7151_30881613.1175875107056 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I can not think of a way to use the SelectKey tage to accomplish this task. You might have to pull them before the insert is called. Just set them on your user POJO and send it your your insert. Should be good to go then. Nahtan On 4/5/07, gumnaam@cox.net wrote: > > Hello All, > I have just started using iBatis, and I have a question about insert > statements. > I see, that there is a selectKey for auto generated columns. > My situation is I have table that has primary key which is auto generated > using a > sequence. I use the selectKey for this column. > But there is another column, UUID, whose value is generated using a PL/SQL > function call. > So my sql is some thing like. > > select seq.nextval from > dual > insert into table (id,uuid,name) values (#id#,new_uuid(),#name#); > > Althought this results in proper insertion, the result object's uuid > property is not set automatically. > is there a way to have the uuid property of the result object set ? > > Similarly what about those columns , who get default values ? Does iBatis > populate the > corrosponding properties ? > > thanks > > ------=_Part_7151_30881613.1175875107056 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I can not think of a way to use the SelectKey tage to accomplish this task.  You might have to pull them before the insert is called.  Just set them on your user POJO and send it your your insert.

Should be good to go then.

Nahtan

On 4/5/07, gumnaam@cox.net <gumnaam@cox.net> wrote:
Hello All,
I have just started using iBatis, and I have a question about insert statements.
I see, that there is a selectKey for auto generated columns.
My situation is I have table that has primary key which is auto generated using a
sequence. I use the selectKey for this column.
But there is another column, UUID, whose value is generated using a PL/SQL function call.
So my sql is some thing like.

<selectKey resultclass="int" keyproperty="id">select seq.nextval from dual</selectKey>
insert into table (id,uuid,name) values (#id#,new_uuid(),#name#);

Althought this results in proper insertion, the result object's uuid property is not set automatically.
is there a way to have the uuid property of the result object set ?

Similarly what about those columns , who get default values ? Does iBatis populate the
corrosponding properties ?

thanks


------=_Part_7151_30881613.1175875107056--