Java Mailing List Archive

http://www.java2.5341.com/

Home » user-java.ibatis »

reading an identity column and inserting it in to other table

Rashid Jilani

2009-02-23

Replies: Find Java Web Hosting

Author LoginPost Reply

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

©2008 java2.5341.com - Jax Systems, LLC, U.S.A.