ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Schall <mike.sch...@gmail.com>
Subject Re: Nested / Multiple Transactions open on same thread?
Date Wed, 04 Jan 2006 19:37:01 GMT
I was looking over the change log to see what else I would be
upgrading and have a question?

Are you referring to IBATISNET-128?

I submitted a patch for that bug and have it in my current build.

My issue is having multiple transactions on the SAME thread.

If another fix is in 1.3 for my issue, can you point me to the key?

Thanks
Mike


On 1/4/06, Gilles Bayon <ibatis.net@gmail.com> wrote:
> The version 1.2.1 has a bug in non web environnement if you use multiple
> SqlMapper.
> You should move to the last version 1.3 which has been released on december.
>
>
>
> On 1/4/06, Michael Schall <mike.schall@gmail.com> wrote:
> > Thanks for the quick reply...
> >
> > I have the source of 1.2.1 compiled under 2005.
> >
> > My DatabaseManager code follows:
> >
> > Public Module DatabaseManager
> >
> >     Private _lock As Object = New Object()
> >     Private _mapper As SqlMapper
> >     Private _nestedMapper As SqlMapper
> >
> >     Public Sub Configure(ByVal configurationFile As FileInfo, ByVal
> nestedConfigurationFile As FileInfo)
> >
> >         Dim builder As DomSqlMapBuilder = New DomSqlMapBuilder()
> >         Dim nestedBuilder As DomSqlMapBuilder = New DomSqlMapBuilder()
> >
> >         SyncLock (_lock)
> >             If _mapper Is Nothing Then
> >                 _mapper = builder.Configure(configurationFile)
> >             End If
> >
> >             If _nestedMapper Is Nothing Then
> >                 If nestedConfigurationFile IsNot Nothing Then
> >
> >                     If _log.IsInfoEnabled Then
> >                         _log.Info("Configuring nested mapper using
> configuration file {0} ", nestedConfigurationFile.Name)
> >                     End If
> >
> >                     _nestedMapper = nestedBuilder.Configure
> (nestedConfigurationFile)
> >
> >                     If _log.IsInfoEnabled Then
> >                         _log.Info("Done configuring nested mapper using
> configuration file {0} ", nestedConfigurationFile.Name)
> >                     End If
> >
> >                 End If
> >             End If
> >
> >         End SyncLock
> >
> >     End Sub
> >
> >     Friend Function NestedInstance() As SqlMapper
> >         Dim mapper As SqlMapper
> >         SyncLock (_lock)
> >             mapper = _nestedMapper
> >         End SyncLock
> >         Return mapper
> >     End Function
> >
> >     Friend Function Instance() As SqlMapper
> >         Dim mapper As SqlMapper
> >         SyncLock (_lock)
> >             mapper = _mapper
> >         End SyncLock
> >         Return mapper
> >     End Function
> >
> > End Module
> >
> >
> >
> > On 1/4/06, Gilles Bayon <ibatis.net@gmail.com > wrote:
> > >
> > > Each SqlMapper use a different 'TLS' session store.
> > > Which iBATIS version do you use ?
> > >
> > >
> > >
> > > On 1/4/06, Michael Schall <mike.schall@gmail.com > wrote:
> > > > I need the ability to have muliple transactions / connections open to
> > > > the same database on the same thread at the same time.
> > > >
> > > > For example I want to:
> > > > 1) Open a connection and transaction (Session1) to a database
> > > > 2) Perform multiple inserts to tables in the database
> > > > 3) Commit and close (Session1)
> > > >
> > > > Easy right.
> > > >
> > > > My problem is that in order to perform the multiple inserts I need to
> > > > get / update information in another table.  I have created multiple
> > > > DomSqlMapBuilders, configure them with different configuration files,
> > > > and store them as separate SqlMapper instances.  So my example needs
> > > > to look like
> > > >
> > > > 1) Open a connection and transaction (Session1 on SqlMapper1) to a
> database
> > > > 2) Open a connection and transaction (Session2 on SqlMapper2) to the
> > > > same database
> > > > 3) Get and Increment Counter (Session2)
> > > > 4) Commit and close (Session2)
> > > > 5) Perform insert to table in the database using counter (Session1)
> > > > 6) Open a connection and transaction (Session2) to the same database
> > > > 7) Get and Increment Counter (Session2)
> > > > 8) Commit and close (Session2)
> > > > 9) Perform insert to table in the database using counter (Session1)
> > > > 10) ...
> > > > 11) Commit and close (Session1)
> > > >
> > > > If for any reason I need to rollback (Session1) at step 10, the
> > > > actions performed on (Session2) should not be rolled back as they have
> > > > been committed.
> > > >
> > > > However when I try and do step 2 SqlMapper2 is already in a
> > > > transaction.  It seems like due to the way the session is stored in
> > > > TLS, it will only allow for one session to be stored per thread.
> > > >
> > > > Is there a way to get this to work?  I can submit code if that helps.
> > > >
> > > > Thanks for your time.
> > > > Mike
> > > >
> > >
> > >
> >
> >
>
>

Mime
View raw message