ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Henricksen" <T...@A-t-g.com>
Subject RE: Differences in versions
Date Thu, 25 Oct 2007 16:27:56 GMT
Thanks Jeff for your suggestions.  That sounds just like our problem.  I
looked up the bug in the issue tracker and I noticed it first when I
started using 2.2 and 2.3.in my testing.

 

Tom

 

-----Original Message-----
From: Jeff Butler [mailto:jeffgbutler@gmail.com] 
Sent: Thursday, October 25, 2007 11:13 AM
To: user-java@ibatis.apache.org
Subject: Re: Differences in versions

 

This is probably related to the bug IBATIS-320 that was fixed for 2.3.
The problem was that open session was broken in earlier versions such
that it always returned the same session no matter how many times it was
called.  The fix makes it work like it should work - where open session
creates a new session every time. 

 

Before, you were executing the insert and the query in the same session
- even though it doesn't look that way.  Now, you are executing them in
two different sessions.  Two different sessions means two different
transactions - hence the locking issue.  You can avoid this by setting
the isolation level to read uncommitted (although I wouldn't recommend
this).  Another way to solve it is to get rid of the open session/close
session stuff and do all your work against the sql map client directly.
IMHO this is preferred.  We don't think that the session stuff is well
understood in general and usually unneeded. 

 

Jeff Butler

 

On 10/25/07, Tom Henricksen <TomH@a-t-g.com> wrote: 

We recently upgraded our application to use iBatis 2.3.0.  We used to
use 2.0.9 and were able to do this:

Condensed example old version

            SqlMapClient client = null; 

            Reader reader = null;

            SqlMapSession mapSession = null;

            reader = Resources.getResourceAsReader ("sqlmaps-config.xml"
);

            client = SqlMapClientBuilder.buildSqlMapClient( reader);

            mapSession = client.openSession();

            // insert the object 

            mapSession.insert(id,parameterObject);

            // look for the object on client before commiting the
session 

            client.queryForList(id);

mapSession.commitTransaction();

            mapSession.endTransaction();

            mapSession.close();

            mapSession = null;

 

Once we updated to iBatis 2.3.0 we now have to commit the object before
searching for it

New versrion

mapSession.commitTransaction();

// commit then look back for object

                        client.queryForList (id);

 

If we don't do this with 2.3.0 we get a row level locking error.

com.ibm.db2.jcc.a.SqlException : DB2 SQL error: SQLCODE: -911, SQLSTATE:
40001, SQLERRMC: 68

      at com.ibm.db2.jcc.a.cc.b( cc.java:2828)

      at com.ibm.db2.jcc.b.be.i( be.java:181)

      at com.ibm.db2.jcc.b.be.a( be.java:142)

      at com.ibm.db2.jcc.b.be.a( be.java:33)

 

I am not sure if this was a bug, design change or something else.
Perhaps we have some configuration that we need to change with the new
version? 

Thanks,

 

                        

Tom Henricksen 
Consultant
Advanced Technologies Group, Inc.

 


Mime
View raw message