ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincent <vinc...@xaymaca.com>
Subject Controlling connections
Date Tue, 10 May 2005 20:19:13 GMT
Hello All,
I have a mysql database that I am doing an insert on.
I also require the resultant ID to use in a subsequent insert.
doing an INSERT INTO ... followed by a SELECT LAST_INSERT_ID()
within the same connection will give me back the ID I require.
Most of the time this is working fine in iBatis. Other times...

PreparedStatement:  INSERT INTO ...
PreparedStatementLogProxy: {pstm-100071}

  ConnectionLogProxy: {conn-100072} Connection
PreparedStatementLogProxy: {pstm-100073} PreparedStatement:    SELECT 

  ConnectionLogProxy: {conn-100075} Connection
PreparedStatementLogProxy: {pstm-100076} PreparedStatement:    INSERT 
INTO ...
PreparedStatementLogProxy: {pstm-100076}
Parameters: [0 <-- ouch, this is supposed to be the last_inserted_id !

also note the different connection ids.

Short of converting my tables to innodb and using transactions
is there a simple way to fix this?

Using latest SQL Maps.
Thank You.

Plato is my friend, Aristotle is my friend, but my greatest friend is truth.
- Isaac Newton

View raw message