ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Urgent help required
Date Fri, 10 Mar 2006 18:07:57 GMT
You woldn't - <selectKey> is used for automatically generated keys (like
identity fields or sequences).  In your case, the insert worked if no
exception is thrown.

Jeff Butler


On 3/10/06, Krishnamoorthi, Sruthi (Raytheon) <
Sruthi.Krishnamoorthi@uspto.gov> wrote:
>
> How to use that select key to tell if my values are inserted or not.
> <insert id="insertCCUser" parameterClass="user">
>        INSERT INTO
> PARTICIPANT(PRTCPNT_ID,GIVEN_NM,MIDDLE_NM,FAMILY_NM,NAME_LINE_ONE_TX,
>
> CITIZENSHIP,STREET_LINE_ONE_TX,STREET_LINE_TWO_TX,
>
> CITY_NM,GEOGRAPHIC_REGION_CD,COUNTRY_CD,POSTAL_CD,PRIMARY_TELEPHONE_NO,PRIMARY_EMAIL_ADDRESS_TX,PASSWORD_TX,
>
> LAST_MODIFIED_USER_ID,LAST_MODIFIED_TS)
>        VALUES((select NVL(max(PRTCPNT_ID)+1,1)userId from PARTICIPANT),
>
> #fname#,#mname#,#lname#,#fname#,#citizenShip#,#street1#,#street2#,#city#,#state#,#country#,#postalCode#,#phone#,#email#,#password#,'US1234',SYSDATE)
> </insert>
>
> Where would I use it here and how
>
> Thanks,
> Sruthi Krishnamoorthi
> 703-562-9732(Work)
> 537 A - (Raytheon) Location
>
>
> -----Original Message-----
> From: larry.meadors@gmail.com [mailto:larry.meadors@gmail.com]On Behalf
> Of Larry Meadors
> Sent: Friday, March 10, 2006 12:58 PM
> To: user-java@ibatis.apache.org
> Subject: Re: Urgent help required
>
>
> I think you only get a value back if you use selectKey.
>
> Larry
>
>
> On 3/10/06, Krishnamoorthi, Sruthi (Raytheon)
> <Sruthi.Krishnamoorthi@uspto.gov> wrote:
> >
> > This is throwing an exception because
> >
> >
> > Integer test = (Integer)sqlMap.insert(qryId,usr);
> >
> > System.out.println("Return value from Insert"+test); id displaying Null
> > value:
> > But a record is getting inserted in Database. //For sure
> > How to confirm that my record got inserted.
> >
> >
> > Thanks,
> > Sruthi Krishnamoorthi
> > 703-562-9732(Work)
> > 537 A - (Raytheon) Location
> >
> > -----Original Message-----
> > From: Nathan.Maves@Sun.COM [mailto:Nathan.Maves@Sun.COM]
> > Sent: Friday, March 10, 2006 12:52 PM
> > To: user-java@ibatis.apache.org
> > Subject: Re: Urgent help required
> > Importance: High
> >
> > Just use
> >
> >
> > Integer rows = ((Integer)sqlMap.insert("insertProduct",
> > product)).intValue();
> >
> >
> > if you are using Java 1.5
> >
> >
> > int rows = (Integer)sqlMap.insert("insertProduct",
> > product);
> >
> >
> > Nathan
> >
> >
> >
> >
> >
> > On Mar 10, 2006, at 10:41 AM, Krishnamoorthi, Sruthi (Raytheon) wrote:
> >
> >
> >
> >
> > The docs says
> >
> >         int rows = sqlMap.insert ("insertProduct", product);
> >
> > returns a int value
> >
> >
> >
> > When I code it ,the return value is object. I am not able to get the int
> > return value. Please help me out.
> >
> >
> > Thanks,
> > Sruthi Krishnamoorthi
> > 703-562-9732(Work)
> > 537 A - (Raytheon) Location
> >
> >
> >
>
>
>

Mime
View raw message