You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Mike Fagan <mf...@tde.com> on 2005/01/20 00:07:50 UTC

How to get sequence number back in inserted object

Hi,

I see how you can perform an insert using a selectKey tag. I there a way 
to assign this value from the selectKey  into inserted object so that I 
can use it again for updates?


Regards,
Mike Fagan



Re: How to get sequence number back in inserted object

Posted by Clinton Begin <cl...@gmail.com>.
Put the SQL to retrieve the last serial value within the selectKey
block and set the property element.

Cheers,
Clinton


On Fri, 21 Jan 2005 11:46:49 +0530, Vamsee Kanakala <va...@gmail.com> wrote:
> Clinton Begin wrote:
> 
> >yep... use the property attribute of the selectKey element.
> >
> >
> >
> But what do I do if I'm using a 'serial' keyword for an integer column
> in Postgres, where it creates it's own sequence and assigns it to the id
> column?
> 
> TIA,
> Vamsee.
>

Re: How to get sequence number back in inserted object

Posted by Vamsee Kanakala <va...@gmail.com>.
Clinton Begin wrote:

>yep... use the property attribute of the selectKey element.
>
>  
>
But what do I do if I'm using a 'serial' keyword for an integer column 
in Postgres, where it creates it's own sequence and assigns it to the id 
column?

TIA,
Vamsee.

Re: How to get sequence number back in inserted object

Posted by Clinton Begin <cl...@gmail.com>.
yep... use the property attribute of the selectKey element.

Clinton


On Wed, 19 Jan 2005 16:07:50 -0700, Mike Fagan <mf...@tde.com> wrote:
> Hi,
> 
> I see how you can perform an insert using a selectKey tag. I there a way
> to assign this value from the selectKey  into inserted object so that I
> can use it again for updates?
> 
> Regards,
> Mike Fagan
> 
>