ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Möller <dcmoel...@gmx.de>
Subject RE: select Key not working giving error.
Date Thu, 12 Jul 2007 14:45:36 GMT

I myself are using this kind of iBATIS config with a Sybase DB:

  <insert id="insertContact" parameterClass="contact">
    insert into CONTACT (PROP1, ...) values (#property1#, ...)
    <selectKey resultClass="long" type="post">
      select @@IDENTITY

"@@IDENTITY" is the Sybase way to retrieve the auto-incremented value of
the primary key column.

As you can see: There is no mapping of the resulting key to a property
of the parameter class. I'm retrieving the auto-incremented key by

  Long generatedKey = (Long) sqlMapClient.insert("insertContact", contact)

Hope this will guide you to a working solution.



View raw message