Hi Andrey,

2014-11-17 15:51 GMT+01:00 Andrey Antukh <[email protected]>:

> Andrey.
>
> Sent from my Nexus 4
> On Nov 17, 2014 11:37 AM, "Lukas Eder" <[email protected]> wrote:
> >
> > Yes, I understand that part of the difference - and I remember your
> criticism. Essentially, jOOQ currently expects you to pass the transaction
> reference (as contained in a derived Configuration) around, whereas ULTM
> probably keeps it somewhere in a ThreadLocal. In jOOQ, the "ThreadLocal
> solution" might emerge in a future version as well, in parallel to the
> existing explicit version (https://github.com/jOOQ/jOOQ/issues/2732). I
> can't promise any ETA, as this might introduce significant changes to all
> of jOOQ's internals.
> >
> > But having both models in parallel isn't so uncommon. In Spring, for
> instance, you can also choose to use "implicit" transactions via
> @Transactional annotations, or "explicit" ones via a transaction manager
> that you have to keep around. In the end, there are these two models. I
> don't see a clear advantage of one over the other, apart from personal
> taste. But I agree that jOOQ currently doesn't offer the "implicit" model.
> >
>
> Implicit is always better than implicit. Personally I prefer the current
> tx jOOQ api over any other like spring...
> It is very flexible and allow implement own implicit  tx management
> without much of problems.
>
> Implicit tx management is not suitable for all cases. In my opinion any
> implicit transaction management should be out of scope of jOOQ (different
> library is a good place for it...)
>
*For the group:* Andrey has implemented Suricatta (
http://niwibe.github.io/suricatta). A SQL API built on top of jOOQ for
Clojure.

*Andrey:* I haven't had a look at the implementation details of your
TransactionProvider yet. If I'm not mistaken, the sources are these ones
here, right?
https://github.com/niwibe/suricatta/blob/7af06380bf566edce092091ff3ff2410fd81107e/src/suricatta/core.clj#L109

Or explicitly:


(defn atomic-apply "Execute a function in one transaction or subtransaction.
" [^Context ctx func & args] (let [^Configuration conf (.derive (proto/
get-configuration ctx)) ^TransactionContext txctx (transaction-context conf)
^TransactionProvider provider (.transactionProvider conf)] (doto conf (.data
"suricatta.rollback" false) (.data "suricatta.transaction" true)) (try (.
begin provider txctx) (let [result (apply func (types/->context conf) args)
rollback? (.data conf "suricatta.rollback")] (if rollback? (.rollback
provider txctx) (.commit provider txctx)) result) (catch Exception cause (.
rollback provider (.cause txctx cause)) (if (instance? RuntimeException
cause) (throw cause) (throw (DataAccessException. "Rollback caused" cause
)))))))

What would your TransactionProvider look like in plain Java code, more or
less?

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to