Align database connections to EJB State Context

8 views
Skip to first unread message

embree...@gmail.com

unread,
Jan 30, 2023, 6:17:11 PM1/30/23
to jOOQ User Group
Assuming no db connection pooler is in play.
1st Question...
Can and if how would I go about aligning 1 database connection/session with each EJB Context.

I am using stateful EJBs and want to set database session variables that would be accessible across all the EJBs for a given EJB session/context.

4 clients -> 4 EJB sessions -> 4 database sessions

2nd Question...
Is it not possible to change the Settings of a DSLContext after it's initialization?

Thanks
-Kevin

Lukas Eder

unread,
Jan 31, 2023, 5:59:36 AM1/31/23
to jooq...@googlegroups.com
Hi Kevin,

Using jOOQ isn't different from using JDBC directly, in such a context. I would imagine you'd have to flush everything in your EJB context for jOOQ to "see" it (just like you would have to, with JDBC). In any case, you probably find more help regarding your EJB specific questions on https://stackoverflow.com, or on some EJB forum. This group here is mainly about jOOQ.

Regarding your second question, yes you can change Settings on an existing DSLContext instance. Just access it via DSLContext.configuration().settings(), knowing that you shouldn't mutate a shared Configuration. It's usually better to "derive" a Configuration using Configuration.derive() (or even deriveSettings()) for these purposes, if you only need locally modified Settings.

I hope this helps
Lukas

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/68007135-660e-431f-8532-c2e1bc0cfe78n%40googlegroups.com.

embree...@gmail.com

unread,
Jan 31, 2023, 9:51:42 AM1/31/23
to jOOQ User Group
Thanks for the information, very helpful
Reply all
Reply to author
Forward
0 new messages