UseGeneratedKeys and thread safety

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

UseGeneratedKeys and thread safety

Vogon
Hi,
If my database supports auto-generated key fields, and in my mapping i
use for example:

<insert id="insertUser" parametrType="business.data.User"
useGeneratedKey="true" keyProperty="id">

is User.id populated in thread-safe manner in every case?
Reply | Threaded
Open this post in threaded view
|

Re: UseGeneratedKeys and thread safety

Simone Tripodi
Hi Vogon,
yes, since this method uses the jdbc
java.sql.Statement#getGeneratedKeys() [1] method in a thread safety
session.
Hope this helps,
Simo

[1] http://download.oracle.com/javase/1.4.2/docs/api/java/sql/Statement.html#getGeneratedKeys()

http://people.apache.org/~simonetripodi/
http://www.99soft.org/



On Mon, Oct 4, 2010 at 12:05 PM, Vogon <[hidden email]> wrote:
> Hi,
> If my database supports auto-generated key fields, and in my mapping i
> use for example:
>
> <insert id="insertUser" parametrType="business.data.User"
> useGeneratedKey="true" keyProperty="id">
>
> is User.id populated in thread-safe manner in every case?