ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmarchwiak <pmarchw...@gmail.com>
Subject Re: Problem with SCOPE_IDENTITY() with SQL Server 2005 Express
Date Wed, 02 May 2007 14:22:38 GMT

I am having the same problem. @@Identity and ident_current work fine. I've
tried both the MS and jtdc drivers. Has anyone had success using

Fearghal O Maolcatha wrote:
> Hi,
> I'm currently using Abator to generate the model, sql maps and DAOs for my
> SQL Server 2005 Express database. I have a number of tables that have
> autogenerated keys and abator is adding the following xml for each of
> these
> keys for the inserts in the sql mapping files:
> <selectKey keyProperty="<beanId>" resultClass="java.lang.Integer">
> </selectKey>
> However when I try to use the autogenerated 'insert()' method of the DAO,
> it
> does not return the generated key and the java bean passed as argument
> doesn't have it's id property updated. I've verified that a row is being
> inserted in the database the the 'insert()' method of the DAO is called
> but
> the <selectKey> part of the insert doesn't seem to be working. I had a
> look
> at previous threads and some had said that they were using the jtds jdbc
> driver so I had swiched to jtds-1.2 (I'm currently using the MS SQL Server
> 2005 JDBC driver, sqljdbc_1.1) but I still encountered the same problem. I
> can get the <selectKey> to work by replacing 'SCOPE_IDENTITY()' with
> '@@IDENTITY AS' but would prefer not to have to alter the generated xml
> and
> I think it is recommended not to use this as there can be problems if DB
> triggers are in use.
> I'm using JDK6, sqljdbc_1.1 as the JDBC driver, Ibatis- and SQL
> Server Express 2005.
> Any help or suggestions on how to rectify the problem would be
> appreciated.
> Regards,
> Fearghal.

View this message in context: http://www.nabble.com/Problem-with-SCOPE_IDENTITY%28%29-with-SQL-Server-2005-Express-tf3637095.html#a10286858
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

View raw message