You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Pablo Lopez <pl...@tecisa74.com> on 2005/02/10 12:22:24 UTC

selectKey

Hi,

I'm having exactly the same problem described at:

http://www.mail-archive.com/ibatis-user-cs@incubator.apache.org/msg00055.html

(I wasn't subscribed yet)

I guess it had no responses.

Any help on retrieving auto-generated keys in insertions?

Thanks,

Pablo.


Re: selectKey

Posted by Pablo Lopez <pl...@tecisa74.com>.
Ron Grabowski wrote:
> Was that included in the latest alpha release? Do I still have to
> includ the "as value" clause? Will this work:
> 
> <selectKey property="PageID" type="post" resultClass="int">
>  SELECT @@IDENTITY
> </selectKey>

It didn't work for me without the cast (under .NET).

See you,

Pablo.

Re: selectKey

Posted by Ron Grabowski <ro...@yahoo.com>.
Was that included in the latest alpha release? Do I still have to
includ the "as value" clause? Will this work:

<selectKey property="PageID" type="post" resultClass="int">
 SELECT @@IDENTITY
</selectKey>

--- Gilles Bayon <ib...@gmail.com> wrote:

> In the last version, there's no need to do the cast.
> 
> -Gilles
> 


Re: selectKey

Posted by Gilles Bayon <ib...@gmail.com>.
In the last version, there's no need to do the cast.

-Gilles

RE: selectKey

Posted by roberto <ro...@theaegis.org>.
There was another thread shortly after that that had an explanation:

 

http://www.mail-archive.com/ibatis-user-cs@incubator.apache.org/msg00067.htm
l

 

Roberto

 

 

> -----Original Message-----

> From: Pablo Lopez [mailto:plopez@tecisa74.com]

> Sent: Thursday, February 10, 2005 6:22 AM

> To: ibatis-user-cs@incubator.apache.org

> Subject: selectKey

> 

> Hi,

> 

> I'm having exactly the same problem described at:

> 

> http://www.mail-archive.com/ibatis-user-

> cs@incubator.apache.org/msg00055.html

> 

> (I wasn't subscribed yet)

> 

> I guess it had no responses.

> 

> Any help on retrieving auto-generated keys in insertions?

> 

> Thanks,

> 

> Pablo.

> 

 


Re: selectKey

Posted by Pablo Lopez <pl...@tecisa74.com>.
Ron Grabowski wrote:
> At the bottom of my post I wrote this:
> 
> <!-- 
> The column named 'value' is used to set the PageID of the
> passed in Page object as well as return an int
> -->
> <selectKey property="PageID" type="post" resultClass="int">
> SELECT CAST(@@IDENTITY as int) as value
> </selectKey>

Yeah, thanks a lot.

Finally the problem had to do both with casts and syntax. I think both 
of them are wrong (or missing) in the manual, and yes, I skipped the 
solution, it was at the bottom of the same post :( sorry.

See you,

Pablo.

Re: selectKey

Posted by Ron Grabowski <ro...@yahoo.com>.
At the bottom of my post I wrote this:

<!-- 
The column named 'value' is used to set the PageID of the
passed in Page object as well as return an int
-->
<selectKey property="PageID" type="post" resultClass="int">
SELECT CAST(@@IDENTITY as int) as value
</selectKey>

--- Pablo Lopez <pl...@tecisa74.com> wrote:

> Hi,
> 
> I'm having exactly the same problem described at:
> 
>
http://www.mail-archive.com/ibatis-user-cs@incubator.apache.org/msg00055.html
> 
> (I wasn't subscribed yet)
> 
> I guess it had no responses.
> 
> Any help on retrieving auto-generated keys in insertions?
> 
> Thanks,
> 
> Pablo.
> 
>