On Wednesday, June 26, 2019 at 9:10:24 AM UTC+2, Kasper Nielsen wrote:
>
> > 
> > though generally-speaking I avoid Guice Persist in new projects; if only 
> because there's no validation that @Transactional is correctly applied and 
> will have any effect (and we've had bugs because of that: @Transaction on 
> private methods for example, or sometimes in classes that weren't 
> instantiated by Guice). 
> Do you use an alternative implementation? Or do you manual handle the 
> transactions?
>

I'm using jOOQ (and was using guice-jooq-persist), so I just use jOOQ's 
transaction management methods (
https://www.jooq.org/doc/3.11/manual/sql-execution/transaction-management/), 
that we wrap into a simple TransactionManager so the jOOQ types aren't 
directly exposed to our non-DAO code.
From:
doInTransaction();
// …
@Transactional void doInTransaction() { … }

to:
transactionManager.transaction(this::doInTransaction);
// …
private void doInTransaction() { … }

(or we could have inlined the doInTransaction method into a lambda)

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/4e06a19a-cf58-44d5-8873-b6841505a0fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to