Discussion:
How I can pass a Object inside a jOOQ transaction?
'Maverick Skywalker' via jOOQ User Group
2018-11-04 16:19:30 UTC
Permalink
I'm using the jOOQ transactions inside a servlet but now I run into a
issue. How I can access the request and response object from inside the
tranaction?

With mockup strings and logging the issue wasn't recognizable. I'm using
JDK 1.8 and Java EE 7 Web.

protected void processRequest(HttpServletRequest request,
HttpServletResponse response) {

// ...

tx.transaction(new TransactionalRunnable() {
@Override
public void run(Configuration configuration) throws Throwable {
DSLContext tx = DSL.using(configuration);


// How I can access the request or response object?

}
}
}
--
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 jooq-user+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Marshall Pierce
2018-11-04 16:26:54 UTC
Permalink
They'll be usable if they're marked `final`, though you might consider
using `transactionResult` instead of `transaction` and doing your
response manipulation outside of the transaction to avoid intermingling
your db manipulation with view logic.
Post by 'Maverick Skywalker' via jOOQ User Group
I'm using the jOOQ transactions inside a servlet but now I run into a
issue. How I can access the request and response object from inside the
tranaction?
With mockup strings and logging the issue wasn't recognizable. I'm using
JDK 1.8 and Java EE 7 Web.
|
protectedvoidprocessRequest(HttpServletRequestrequest,HttpServletResponseresponse){
// ...
    tx.transaction(newTransactionalRunnable(){
@Override
publicvoidrun(Configurationconfiguration)throwsThrowable{
DSLContexttx =DSL.using(configuration);
// How I can access the request or response object?
}
}
}
|
--
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
For more options, visit https://groups.google.com/d/optout.
--
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 jooq-user+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Maverick Skywalker' via jOOQ User Group
2018-11-04 18:46:56 UTC
Permalink
Thanks for your advice I have marked both parameters as final and it's
working: :)

Your second advice with the transactionResult I will check another day. I
couldn't find a example so it will take some time.
--
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 jooq-user+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...