Hello list,
I have "Person" class with several phone numbers (0-*) I have the numbers in a
separate table with two columns, persId and number. When I insert the person I
want to insert the phone numbers, too. So I wrote:
<insert id="insertPerson" parameterClass="Person">
INSERT INTO Person ( salutation, degree, firstname, )
VALUES ( #salutation:VARCHAR#, #degree:VARCHAR#,
#firstname:VARCHAR# );
<selectKey resultClass="int" >
SELECT @@IDENTITY AS ID
</selectKey>
<iterate property="telefonNrs" conjunction="; ">
INSERT INTO phoneNumbers (persId, number)
VALUES ( id, #telefonNrs[]# )
</iterate>
</insert>
The problem is: I need the auto-generated person key to insert the phone
numbers. How can I get?
Greetings Eric