Re: Support for nested transactions

2018-08-10 Thread Dan Haywood
Hi Vladimir,
That might well work, but double check if that also sets up a transaction
also. I can't remember if there's also a similar doInTransaction (...)?

Basically the design  is usually a single transaction within a single
session.

HTH,
Dan.

On Fri, 10 Aug 2018, 14:19 Vladimir Nišević,  wrote:

> Hi Dan, we found that simply starting new Thread and using IsisContext
> works as well. Would be that also feasible approach?
>
> Regs
> Vladimir
>
> new Thread(() -> {
> IsisContext.getSessionFactory().doInSession(() ->
> doSomeStuffWithNewDatabaseTransactionHere);
> }).start();
>
>
> Am Fr., 10. Aug. 2018 um 11:11 Uhr schrieb Vladimir Nišević <
> vnise...@gmail.com>:
>
> > Hi Dan, thanks for the fast reply!
> >
> > Yes, we tried already with TransactionsService but this is not enough
> > since this supports only one at the time.
> >
> > We will go for the solution using AbstractIsisSessionTemplate!
> >
> > Thanks
> > Vladimir
> >
> >
> > Am Fr., 10. Aug. 2018 um 10:06 Uhr schrieb Dan Haywood <
> > d...@haywood-associates.co.uk>:
> >
> >> Hi Vladimir,
> >> A couple of ideas which might help.
> >>
> >> First, there's the Transactions device that allows you to commit the
> >> automatically created transaction and then start a new one. This lets
> you
> >> have multiple transactions within a given request/session. However,
> >> there's
> >> no support for catching errors/rollbacks.
> >>
> >> Alternatively, you could use a regular java Executor/thread pool and
> then
> >> have the threads create their own session using
> >> AbstratIsisSessionTemplate.
> >>
> >> Or, you create background commands and have them invoked via a
> background
> >> scheduler. In 1.x you will need to being in quartz, but 2.0.0-M1 has
> >> built-in support.
> >>
> >> HTH,
> >> Dan.
> >>
> >> On Fri, 10 Aug 2018, 08:58 Vladimir Nišević, 
> wrote:
> >>
> >> > Hi folks, as I understand, Isis supports by default one JDBC
> >> transaction at
> >> > time as part of single IsisTransaction and single IsisSession.
> >> >
> >> > We have a case where we would need nested JDBC transactions or
> multiple
> >> > parallel transactions where some of the transactions we would need to
> >> > rollback and some of them commit.
> >> >
> >> > Any ideas how to achieve this
> >> >
> >> >
> >> > Kind regards
> >> > Vladimir
> >> >
> >> --
> >> DISCLAIMER: This e-mail is from Haywood Associates Ltd (Registered
> Number
> >> 3525455) and it and its attachments may be confidential and are intended
> >> solely for the use of the individual to whom it is addressed.  Any
> >> unauthorised use or dissemination of this communication is strictly
> >> prohibited. Any information provided to Haywood Associates Ltd shall be
> >> retained and used in accordance with our Privacy Statement at
> >> http://www.haywood-associates.co.uk/privacy.  If you have received this
> >> communication in error, please immediately notify the sender by return
> >> e-mail message and delete all copies of the original communication.
> >>
> >
>
-- 
DISCLAIMER: This e-mail is from Haywood Associates Ltd (Registered Number
3525455) and it and its attachments may be confidential and are intended
solely for the use of the individual to whom it is addressed.  Any
unauthorised use or dissemination of this communication is strictly
prohibited. Any information provided to Haywood Associates Ltd shall be
retained and used in accordance with our Privacy Statement at
http://www.haywood-associates.co.uk/privacy.  If you have received this
communication in error, please immediately notify the sender by return
e-mail message and delete all copies of the original communication.


Re: Support for nested transactions

2018-08-10 Thread Vladimir Nišević
Hi Dan, we found that simply starting new Thread and using IsisContext
works as well. Would be that also feasible approach?

Regs
Vladimir

new Thread(() -> {
IsisContext.getSessionFactory().doInSession(() ->
doSomeStuffWithNewDatabaseTransactionHere);
}).start();


Am Fr., 10. Aug. 2018 um 11:11 Uhr schrieb Vladimir Nišević <
vnise...@gmail.com>:

> Hi Dan, thanks for the fast reply!
>
> Yes, we tried already with TransactionsService but this is not enough
> since this supports only one at the time.
>
> We will go for the solution using AbstractIsisSessionTemplate!
>
> Thanks
> Vladimir
>
>
> Am Fr., 10. Aug. 2018 um 10:06 Uhr schrieb Dan Haywood <
> d...@haywood-associates.co.uk>:
>
>> Hi Vladimir,
>> A couple of ideas which might help.
>>
>> First, there's the Transactions device that allows you to commit the
>> automatically created transaction and then start a new one. This lets you
>> have multiple transactions within a given request/session. However,
>> there's
>> no support for catching errors/rollbacks.
>>
>> Alternatively, you could use a regular java Executor/thread pool and then
>> have the threads create their own session using
>> AbstratIsisSessionTemplate.
>>
>> Or, you create background commands and have them invoked via a background
>> scheduler. In 1.x you will need to being in quartz, but 2.0.0-M1 has
>> built-in support.
>>
>> HTH,
>> Dan.
>>
>> On Fri, 10 Aug 2018, 08:58 Vladimir Nišević,  wrote:
>>
>> > Hi folks, as I understand, Isis supports by default one JDBC
>> transaction at
>> > time as part of single IsisTransaction and single IsisSession.
>> >
>> > We have a case where we would need nested JDBC transactions or multiple
>> > parallel transactions where some of the transactions we would need to
>> > rollback and some of them commit.
>> >
>> > Any ideas how to achieve this
>> >
>> >
>> > Kind regards
>> > Vladimir
>> >
>> --
>> DISCLAIMER: This e-mail is from Haywood Associates Ltd (Registered Number
>> 3525455) and it and its attachments may be confidential and are intended
>> solely for the use of the individual to whom it is addressed.  Any
>> unauthorised use or dissemination of this communication is strictly
>> prohibited. Any information provided to Haywood Associates Ltd shall be
>> retained and used in accordance with our Privacy Statement at
>> http://www.haywood-associates.co.uk/privacy.  If you have received this
>> communication in error, please immediately notify the sender by return
>> e-mail message and delete all copies of the original communication.
>>
>


Re: Support for nested transactions

2018-08-10 Thread Vladimir Nišević
Hi Dan, thanks for the fast reply!

Yes, we tried already with TransactionsService but this is not enough since
this supports only one at the time.

We will go for the solution using AbstractIsisSessionTemplate!

Thanks
Vladimir


Am Fr., 10. Aug. 2018 um 10:06 Uhr schrieb Dan Haywood <
d...@haywood-associates.co.uk>:

> Hi Vladimir,
> A couple of ideas which might help.
>
> First, there's the Transactions device that allows you to commit the
> automatically created transaction and then start a new one. This lets you
> have multiple transactions within a given request/session. However, there's
> no support for catching errors/rollbacks.
>
> Alternatively, you could use a regular java Executor/thread pool and then
> have the threads create their own session using AbstratIsisSessionTemplate.
>
> Or, you create background commands and have them invoked via a background
> scheduler. In 1.x you will need to being in quartz, but 2.0.0-M1 has
> built-in support.
>
> HTH,
> Dan.
>
> On Fri, 10 Aug 2018, 08:58 Vladimir Nišević,  wrote:
>
> > Hi folks, as I understand, Isis supports by default one JDBC transaction
> at
> > time as part of single IsisTransaction and single IsisSession.
> >
> > We have a case where we would need nested JDBC transactions or multiple
> > parallel transactions where some of the transactions we would need to
> > rollback and some of them commit.
> >
> > Any ideas how to achieve this
> >
> >
> > Kind regards
> > Vladimir
> >
> --
> DISCLAIMER: This e-mail is from Haywood Associates Ltd (Registered Number
> 3525455) and it and its attachments may be confidential and are intended
> solely for the use of the individual to whom it is addressed.  Any
> unauthorised use or dissemination of this communication is strictly
> prohibited. Any information provided to Haywood Associates Ltd shall be
> retained and used in accordance with our Privacy Statement at
> http://www.haywood-associates.co.uk/privacy.  If you have received this
> communication in error, please immediately notify the sender by return
> e-mail message and delete all copies of the original communication.
>


Re: Support for nested transactions

2018-08-10 Thread Dan Haywood
Hi Vladimir,
A couple of ideas which might help.

First, there's the Transactions device that allows you to commit the
automatically created transaction and then start a new one. This lets you
have multiple transactions within a given request/session. However, there's
no support for catching errors/rollbacks.

Alternatively, you could use a regular java Executor/thread pool and then
have the threads create their own session using AbstratIsisSessionTemplate.

Or, you create background commands and have them invoked via a background
scheduler. In 1.x you will need to being in quartz, but 2.0.0-M1 has
built-in support.

HTH,
Dan.

On Fri, 10 Aug 2018, 08:58 Vladimir Nišević,  wrote:

> Hi folks, as I understand, Isis supports by default one JDBC transaction at
> time as part of single IsisTransaction and single IsisSession.
>
> We have a case where we would need nested JDBC transactions or multiple
> parallel transactions where some of the transactions we would need to
> rollback and some of them commit.
>
> Any ideas how to achieve this
>
>
> Kind regards
> Vladimir
>
-- 
DISCLAIMER: This e-mail is from Haywood Associates Ltd (Registered Number
3525455) and it and its attachments may be confidential and are intended
solely for the use of the individual to whom it is addressed.  Any
unauthorised use or dissemination of this communication is strictly
prohibited. Any information provided to Haywood Associates Ltd shall be
retained and used in accordance with our Privacy Statement at
http://www.haywood-associates.co.uk/privacy.  If you have received this
communication in error, please immediately notify the sender by return
e-mail message and delete all copies of the original communication.