Aside to mysql identity semantics, in all cases iBatis will return the db generated value as the return of the sqlmap.insert() call.
Additionally in your use case below, if the 'RegisteredUser' object has a
'ID' attribute, ibatis will set it to the db generated value. You can also
control the attribute that ibatis will set the value into using
'keyProperty' of <selectkey>
Mario
"Rashid Jilani"
<jil...@lifebiosy
stems.com> To
<[email protected]>
24/02/2009 01:53 cc
Subject
Please respond to reading an identity column and
user-j...@ibatis. inserting it in to other table
apache.org
Hi: guys can some one shed some light how to read an identity column in
mysql and update the other table with the identity value.
E.g <insert id="inseretIntoUser"
parameterClass="com.lifebiosystems.domain.RegisteredUser">
INSERT INTO address(zip, country)
VALUES(#address.zip#, #address.country#)
<selectKey resultClass="int" >
SELECT @@IDENTITY AS id
</selectKey>
</insert>
I am not sure how to read the value of id and use in a different insert
statement
Thanks,
RJ
