ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From PLC_David <spaceman...@gmx.de>
Subject selectKey twice
Date Wed, 03 Sep 2008 08:52:49 GMT


i have a problem with an insert.
I need two generated ids to avoid an update after the insert.

My Question is: Is it possible to use two selectKey Tags.
Ibatis throws no exception, instead I get the correct id at the first
selectKey and 0 at the second selectKey. 

<insert id="insertCd" parameterClass="cd">
		<selectKey resultClass="int" keyProperty="id">
			SELECT COALESCE(max(ID)+1,1) from CD
		<selectKey resultClass="int" keyProperty="db.id">
			SELECT COALESCE(max(ID)+1,1) from DB
                INSERT INTO .... (ID, DB_ID, ....)
		VALUES (#id#, #db.id#, ...)
View this message in context: http://www.nabble.com/selectKey-twice-tp19285322p19285322.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

View raw message