ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gwyn Evans" <gwyn.ev...@gmail.com>
Subject Re: Re-Post:: Same Connection Guaranteed during a Transaction?
Date Mon, 31 Jul 2006 07:15:05 GMT
Just from the docs, that looks to be solved by the <selectKey>
statements in 2.0 - Is that an option?


On 31/07/06, Fred Janon <fjanon@yahoo.com> wrote:
> Sorry for the repost, but I am atill looking for an answer to my
> question. Basically I need to do an INSERT and get the ID (PK) of the
> insert in mySQL. MySQL has the "last_insert_id()" function to do that
> but it has to be executed in the same connection as the INSERT,
> otherwise it returns 0. I have 2 mapped statements in my XML maps, one
> to do the insert and one to do the last_insert_id(). I need to find a
> way to execute them in the same connection. I tried to include the 2
> stements in a transaction but they are still executed in 2 connections.

View raw message