ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Maves" <nathan.ma...@gmail.com>
Subject Re: Problem with insertKey
Date Thu, 01 Nov 2007 16:51:52 GMT
on a side note make sure that you are calling the "insert" method on the
sqlmapclient and not update or execute.

Nathan

On Nov 1, 2007 9:48 PM, Odelya Glick <odelya@jpost.com> wrote:

> Well,
>
> I changed it, but it always puts value 0.
>
> The sequence is declared like this:
>
> CREATE SEQUENCE obituary_seq
>    INCREMENT BY 3
>    START WITH 100
>    NOMAXVALUE
>    MINVALUE 100
>    NOCYCLE
>    CACHE 20
>    NOORDER
>
> What could be the problem?
>
> Many thanks,
>
> Odelya
>
>
> -----Original Message-----
> From: Jean-Francois Poilpret [mailto:jfpoilpret@yahoo.fr]
> Sent: Thursday, November 01, 2007 4:40 PM
> To: user-java@ibatis.apache.org
> Subject: RE: Problem with insertKey
>
> An Oracle sequence cannot map to a String, so your condolence class should
> have the following properties:
> int id; (or long)
> String status;
>
> Cheers
>
> Jean-Francois
>
> -----Original Message-----
> From: Odelya Glick [mailto:odelya@jpost.com]
> Sent: Friday, November 02, 2007 9:21 AM
> To: user-java@ibatis.apache.org
> Subject: Problem with insertKey
>
>
> Hi,
>
> I am trying to receive primary key with:
> <insert id="insertCondolence" parameterClass="condolence">
>                <selectKey keyProperty="id" resultClass="int">
>                        SELECT obituary_seq.NEXTVAL AS value FROM dual
>                </selectKey>
>                INSERT INTO CONDOLENCE(ID, STATUS)
>                VALUES(#id#,#status#)
>        </insert>
>
> The condolence class has 2 properties:
> String id;
> String status;
>
> But it always inserts a record with the right status value, but id value
> is
> always null!!
>
> Why?
>
> Thanks
> Odelya
> web-programmer
> 050-2052075
>
>
>
>
>
>
>
>
>
> ****************************************************************************
> ********
> This footnote confirms that this email message has been scanned by
> PineApp Mail-SeCure for the presence of malicious code, vandals & computer
> viruses.
>
> ****************************************************************************
> ********
>
>
>
>
>

Mime
View raw message