ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leonardo Kenji Shikida <shik...@gmail.com>
Subject Re: how to commit a connection?
Date Tue, 06 Dec 2005 16:02:16 GMT
On 12/6/05, Clinton Begin <clinton.begin@gmail.com> wrote:

>  <transactionManager ....  commitRequired="true">
>
>  The problem is that iBATIS only commits if it is aware of an actual update.
>  Bypassing the insert statement causes iBATIS to miss the fact that an
> update has occurred.
>

how could I tell IBatis that the following method,

myClass.executeSomeSqlWithoutIbatisHere(con);

in this given context, means an actual update?

>  Cheers,
>  Clinton
>
>
> On 12/5/05, Leonardo Kenji Shikida <shikida@gmail.com> wrote:
> > I have an application that uses ibatis and an older legacy database
> > schema, both in the same mysql database.
> >
> > I would like to share the same connection to ibatis methods and the
> > legacy code, so I could use transactions to control both applications
> >
> > I have a snippet as follows
> >
> > SqlMapClient dbclient =
> >
> SqlMapClientBuilder.buildSqlMapClient(sqlMapConfigFileReader);
> > Connection con = null;
> > try{
> >   dbclient.startTransaction();
> >   con = dbclient.getCurrentConnection ();
> >   //////dbclient.insert("insertMyObject",new MyObject());
> >   myClass.executeSomeSqlWithoutIbatisHere(con);
> >   dbclient.commitTransaction();
> > }catch(Exception e){
> >   e.printStackTrace();
> > }finally{
> >   try{
> >     dbclient.endTransaction();
> >   }catch(Exception e2){
> >     e2.printStackTrace();
> >   }
> > }
> >
> > this code does not commit, but if I uncomment the insert statement, it
> > commits. So maybe dbclient checks for some flag or configures some
> > scope or context in the insert method.
> >
> > no exception is raised in both situations
> >
> > how could I set this flag or what's the correct approach for this
> situation?
> >
> > seems clear to me that I could open a session, get the datasource,
> > than get the connection, then close the connection, then close the
> > session, etc etc etc, but I am not sure if it's the best way to do
> > this.
> >
> > thanks in advance
> >
> > Kenji
> > _______________________
> > http://kenjiria.blogspot.com
> > http://gaitabh.blogspot.com
> >
>
>


--

[]

Kenji
_______________________
http://kenjiria.blogspot.com
http://gaitabh.blogspot.com

Mime
View raw message