Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 32699 invoked from network); 4 Jul 2006 22:42:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Jul 2006 22:42:35 -0000 Received: (qmail 35017 invoked by uid 500); 4 Jul 2006 22:42:34 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 34795 invoked by uid 500); 4 Jul 2006 22:42:33 -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 34784 invoked by uid 99); 4 Jul 2006 22:42:33 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Jul 2006 15:42:33 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of jeffgbutler@gmail.com designates 66.249.92.174 as permitted sender) Received: from [66.249.92.174] (HELO ug-out-1314.google.com) (66.249.92.174) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Jul 2006 15:42:32 -0700 Received: by ug-out-1314.google.com with SMTP id k3so1424842ugf for ; Tue, 04 Jul 2006 15:42:11 -0700 (PDT) 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=Uf4Tl32h12wsLGwsXs1GWTV0QwiM5ZdxfUzo7WKN/4Dsu9Kh2B8t052G1C8ttzIT8snplRhInFZuHmREe1PsU4yvx+ZN4Lo+n5b2wpbcuhEH+fp7wUjKmbbkXDqr92/4RXFfvIru1kYHjRv+j7u18AGcuWT184TR3vCVog31rxI= Received: by 10.67.26.7 with SMTP id d7mr7025729ugj; Tue, 04 Jul 2006 15:42:11 -0700 (PDT) Received: by 10.66.238.18 with HTTP; Tue, 4 Jul 2006 15:42:11 -0700 (PDT) Message-ID: Date: Tue, 4 Jul 2006 17:42:11 -0500 From: "Jeff Butler" To: user-java@ibatis.apache.org Subject: Re: insert with id as return value In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_36761_3872674.1152052931092" References: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_36761_3872674.1152052931092 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline The iBATIS function you are looking for is - this is specifically designed for this situation. Abator will generate statements for you if you use the Abator configuration element. Jeff Butler On 7/4/06, Thomas Karl Schwaerzler wrote: > > > hi, > > doesn't really look like: > > OdmLinkDAOImpl.java: > > > > /** > * This method was generated by Abator for iBATIS. > * This method corresponds to the database table c108272dev.ODM_LINK > * > * @abatorgenerated Tue Jul 04 18:48:58 CEST 2006 > */ > public void insert(OdmLink record) { > insert("c108272dev_ODM_LINK.abatorgenerated_insert", record); > } > > > > > greets > tom. > > On Tue, 4 Jul 2006, Graeme J Sweeney wrote: > > > On Tue, 4 Jul 2006, Thomas Karl Schwaerzler wrote: > > > > You don't have to do this > > > >> link.setId(id); > > > > as this call > > > >> linkDao.insert(link); > > > > will return you the id. Check the javadoc of your DAO (or > LinkDAOImpl.java). > > > > -- > > Graeme - > > > ------=_Part_36761_3872674.1152052931092 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
The iBATIS function you are looking for is <selectKey> - this is specifically designed for this situation.
 
Abator will generate <selectKey> statements for you if you use the <generatedKey> Abator configuration element.
 
Jeff Butler
 
 

 
On 7/4/06, Thomas Karl Schwaerzler <Thomas.Schwaerzler@student.uibk.ac.at> wrote:

hi,

doesn't really look like:

OdmLinkDAOImpl.java:

<snip>

   /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table c108272dev.ODM_LINK
     *
     * @abatorgenerated Tue Jul 04 18:48:58 CEST 2006
     */
    public void insert(OdmLink record) {
        insert("c108272dev_ODM_LINK.abatorgenerated_insert", record);
    }


</snip>

greets
tom.

On Tue, 4 Jul 2006, Graeme J Sweeney wrote:

> On Tue, 4 Jul 2006, Thomas Karl Schwaerzler wrote:
>
> You don't have to do this
>
>>              link.setId(id);
>
> as this call
>
>>              linkDao.insert(link);
>
> will return you the id. Check the javadoc of your DAO (or LinkDAOImpl.java).
>
> --
> Graeme -
>

------=_Part_36761_3872674.1152052931092--