Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 13629 invoked from network); 5 Jul 2006 17:33:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Jul 2006 17:33:02 -0000 Received: (qmail 28781 invoked by uid 500); 5 Jul 2006 17:32:59 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 28761 invoked by uid 500); 5 Jul 2006 17:32: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 28750 invoked by uid 99); 5 Jul 2006 17:32:59 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2006 10:32:59 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [138.232.1.142] (HELO smtp.uibk.ac.at) (138.232.1.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2006 10:32:58 -0700 Received: from smd.uibk.ac.at (smd.uibk.ac.at [138.232.1.227]) by smtp.uibk.ac.at (8.13.1/8.13.1/F1) with ESMTP id k65HWa2v027767 for ; Wed, 5 Jul 2006 19:32:36 +0200 Received: from smd.uibk.ac.at (localhost [127.0.0.1] csab9086@uibk.ac.at) by smd.uibk.ac.at (8.13.6+Sun/uibk) with ESMTP id k65HWaCj004935 for ; Wed, 5 Jul 2006 19:32:36 +0200 (MEST) Received: from localhost (csab9086@localhost) by smd.uibk.ac.at (8.13.6+Sun/8.13.6/Submit) with ESMTP id k65HWaIQ004929 for ; Wed, 5 Jul 2006 19:32:36 +0200 (MEST) X-Authentication-Warning: smd.uibk.ac.at: csab9086 owned process doing -bs Date: Wed, 5 Jul 2006 19:32:36 +0200 (MEST) From: Thomas Karl Schwaerzler To: user-java@ibatis.apache.org Subject: RE: insert with id as return value (fwd) In-Reply-To: <50CA25BD6EEA954FA592C097399942E313A806ED@CM1.wis.local> Message-ID: References: <50CA25BD6EEA954FA592C097399942E313A806ED@CM1.wis.local> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Score: -4.4 () ALL_TRUSTED,RCV_SMTP_UIBK X-Scanned-By: MIMEDefang 2.52 at uibk.ac.at on 138.232.1.140 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N you're right. that was the problem. if i specify identity="false" everything works as expected as i ve been told by jeff butler already. thanks for your help. On Wed, 5 Jul 2006, Niels Beekman wrote: > Hi, > > I don't have any experience with Abator but it seems logical to me that > when you specify identity="true" Abator will generate the id > select-query after insertion because identity means the database > auto-generates it for you. What results do you get when you specify > identity="false"? > > Niels > > -----Original Message----- > From: Thomas Karl Schwaerzler > [mailto:Thomas.Schwaerzler@student.uibk.ac.at] > Sent: woensdag 5 juli 2006 18:46 > To: user-java@ibatis.apache.org > Subject: Re: insert with id as return value (fwd) > > > hello again, > > > i have tried this in different versions but cant get the expected > result: > > here my table definition as sql: > > ID NOT NULL NUMBER > WORKFLOW_ID NOT NULL NUMBER > ACTION_ID NOT NULL NUMBER > URL NOT NULL VARCHAR2(255) > NAME NOT NULL VARCHAR2(255) > TARGET VARCHAR2(255) > > > > here my table definition in abatorConfig.xml: > > > sqlStatement="SELECT > c108272dev.ODM_LINK_COUNTER.nextval AS id FROM dual" /> >
> > > > the sqlmap i get looks like this: > > parameterClass="org.dea.odm.model.abator.model.OdmLink"> > > insert into c108272dev.ODM_LINK (WORKFLOW_ID, ACTION_ID, URL, NAME, > TARGET) > values (#workflowId:DECIMAL#, #actionId:DECIMAL#, #url:VARCHAR#, > #name:VARCHAR#, #target:VARCHAR#) > > > SELECT c108272dev.ODM_LINK_COUNTER.nextval AS id FROM dual > > > > > > .. and i'm missing the ID to be inserted and taken from the query below. > > > the desired result would be something like this: > > > parameterClass="org.dea.odm.model.dao.beans.LinkDaoBean"> > > select ODM_LINK_COUNTER.NEXTVAL as "id" from dual > > INSERT INTO ODM_LINK > (ID, WORKFLOW_ID, ACTION_ID, URL, NAME, TARGET) > VALUES (#id#, #workflowId#, #actionId#, #url#, #name#, > #target#) > > > > > > .. i cant find out why ibatis does not insert the primary key 'id' ... > > > thanks for advices > tom. > > > On Tue, 4 Jul 2006, Jeff Butler wrote: > >> 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 - >>>> >>> >> >