Thanks Pablo.

After viewing your code and comparing it to mine, I noticed that I had
resultclass instead of resultClass.  Everything is working now.



-----Original Message-----
From: Pablo Lopez [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 07, 2005 10:22 AM
To: ibatis-user-cs@incubator.apache.org
Subject: Re: <selectKey> stanza with <insert>

This is my code and it's working, I hope it helps.

It's PostgreSQL and IBatis.Net. I first select the generated key from 
the sequence and then insert the rest of the fields.

<insert id="InsertarPermiso" parameterClass="Permiso">
        <selectKey property="IdPermiso" type="post" resultClass="int">
                SELECT cast(last_value as int) AS value
                FROM permisos_id_permiso_seq
        </selectKey>

        INSERT INTO permisos ... (all values except key)

</insert>

See you,

Pablo.

Keslar, Jeremy wrote:
> I am trying to return the generated value of my key field after an 
> insert statement using the <selectKey> stanza.  My SQLMapper returns 0 
> every time.  Any ideas?
> 
>  
> 
> Jeremy
> 

Reply via email to