Thanks.  works great!

Doug



----- Original Message ----
From: Jeff Butler <[EMAIL PROTECTED]>
To: [email protected]
Sent: Thursday, August 7, 2008 1:56:15 PM
Subject: Re: Can Insert mapped statement be reuse?


If you setup your (a)ibator configurations using the <generatedKey> element, 
then (a)ibator will generate the <selectKey> for you.  This is the best 
solution, I think.
 
Jeff Butler


On Thu, Aug 7, 2008 at 2:45 PM, Doug Flex <[EMAIL PROTECTED]> wrote:

Hi,

I want to get the primary key (which is auto increment) return to my object 
after the insert statement.  I don't want to modify the generated insert 
statement from Sqlmap because I want to continue to take advantage of the 
generated code for future changes in the database.  Is there a way to reuse the 
insert statement similiar to the way you re-use SQL?  

1) This is Abator generated code
  <insert id="abatorgenerated_insert" parameterClass="MyClass">
    insert sql statement here ....
  </insert>
 
2) this is manual code is my attempt to reuse the generated insert statement in 
step 1.  But this doesn't work.  Is there a way to do this correctly?
  <insert id="insert_withReturnId" parameterClass="MyClass">
      <include refid="abatorgenerated_insert" />   <<-- THIS DOESN'T WORK
        <selectKey resultClass="int" keyProperty="Id" type="post">
            SELECT LAST_INSERT_ID()
      </selectKey>
  </insert>


      

Reply via email to