Today porting some benchmark code to Hibernate ORM 5.2 I had several
difficulties around the fact that the code now needs to be different
depending on transactions being container managed or not.
My goal was to have a single benchmark test which I could compile once
and run in either JavaSE or CMT
The problem with "execute in isolation" here is that the "isolation" aspect
refers to being isolated from any current transaction. It says nothing
about whether that stuff-to-execute should itself be transacted. This is
why, for example, you see IsolationDelegate accept a `transacted` boolean
arg
As another option we could define something like this on SF:
T doInIsolatedSession(BiFunction work);
T doInIsolatedSession(Function work);
The spec here would be to make sure any current transaction is suspended
(JTA), a new Session opened, the function performed and the suspended
transaction i
On 14 September 2016 at 20:32, Steve Ebersole wrote:
> The problem with "execute in isolation" here is that the "isolation" aspect
> refers to being isolated from any current transaction. It says nothing
> about whether that stuff-to-execute should itself be transacted. This is
> why, for exampl
"Better" according to whom? ;)
I personally very much dislike the kind of API explosion this kind of thing
leads to.
On Wed, Sep 14, 2016 at 2:59 PM Sanne Grinovero wrote:
> On 14 September 2016 at 20:32, Steve Ebersole wrote:
> > The problem with "execute in isolation" here is that the "isol
Also, why do you keep defining this in terms of Session, rather than
SessionFactory?
On Wed, Sep 14, 2016 at 3:01 PM Steve Ebersole wrote:
> "Better" according to whom? ;)
>
> I personally very much dislike the kind of API explosion this kind of
> thing leads to.
>
>
> On Wed, Sep 14, 2016 at 2
On 14 September 2016 at 21:02, Steve Ebersole wrote:
> Also, why do you keep defining this in terms of Session, rather than
> SessionFactory?
I mentioned that same doubt in my first email of this thread.
I think I prefer Session as that's what people interact with most of
the time, and it's a bet
Most transaction systems do not support nested transactions
On Wed, Sep 14, 2016 at 3:13 PM Sanne Grinovero wrote:
> On 14 September 2016 at 21:02, Steve Ebersole wrote:
> > Also, why do you keep defining this in terms of Session, rather than
> > SessionFactory?
>
> I mentioned that same doubt
Naming aside, my favorite approach is to have an "executor" available from
SessionFactory for accepting this functional-interface (lambda). The
executor would be configured with whether to isolate the work and whether
to transact it. Something like:
Executor getExecutor(boolean isolated, boolean