ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thanh PHAM <...@pham.me>
Subject Re: useGeneratedKeys, data not inserted, ibatis 3.0 trunk and sql 2005
Date Wed, 07 Oct 2009 14:21:41 GMT
You're right, I thought the auto-commit is by default.

Thanks for the response and sorry for my spam.


2009/10/7 Poitras Christian <Christian.Poitras@ircm.qc.ca>

>  Did you call SqlSession.commit() and SqlSession.close()?
>
> The usual pattern is
> SqlSession sqlSession = sqlSessionFactory.openSession();
> try {
>   // Do come inserts / updates / deletes
>   sqlSession.commit();
> } finally {
>   sqlSession.close();
> }
>
> Christian
>
>  ------------------------------
> *From:* Thanh PHAM [mailto:dev@pham.me]
> *Sent:* Wednesday, October 07, 2009 5:18 AM
> *To:* user-java@ibatis.apache.org
> *Subject:* useGeneratedKeys, data not inserted, ibatis 3.0 trunk and sql
> 2005
>
> Hi,
>
> I tried to use useGeneratedKeys for mssql 2005, latest driver version.
> The identity is incremented and everything seem OK but the data is not
> present in the table.
>
> Here is my xml and log.
>
> <insert id="insertXtp" parameterType="map" keyProperty="id"
> useGeneratedKeys="true">
>     insert into xtp_selectkey (label) values (#{label})
> </insert>
>
> setting : <setting name="useGeneratedKeys" value="true"/>
>
> Driver version 2.0.1803.100 sqljdbc.jar
> ibatis version : 3.0-beta4 7 Oct 2009
>
> log :
> Connection (26) - ooo Connection Opened
> PreparedStatement (26) - ==>  Executing: insert into xtp_selectkey (label)
> values (?)
> PreparedStatement (26) - ==> Parameters: title(String)
> Connection (26) - xxx Connection Closed
>

Mime
View raw message