Hello,

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>    
                <selectKey resultClass="int" keyProperty="db.id">
                        SELECT COALESCE(max(ID)+1,1) from DB
                </selectKey>)
                INSERT INTO .... (ID, DB_ID, ....)
                VALUES (#id#, #db.id#, ...)
</insert>
-- 
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.

Reply via email to