Thanks for the information, I will look into if that is a better solution. 
Postgres 'SET' is defined for a 'Session'. If my DSLContext comes from a 
DataSource resource that uses connection pooling. 
Can the postgres session change from one transaction to another?

Thanks for the help,
-Kevin

On Monday, February 25, 2019 at 3:51:06 AM UTC-5, Lukas Eder wrote:
>
> Do note that RecordListeners only work on UpdatableRecord.store(), 
> insert(), update(), delete() methods, not on arbitrary SQL statements run 
> through jOOQ or outside of jOOQ.
>
> In most applications I've ever worked on in the past, things like user or 
> other contextual information was set on some database context variable. In 
> Oracle, this would be SYS_CONTEXT. PostgreSQL knows the SET LOCAL command: 
> https://stackoverflow.com/a/48104134/521799. Other RDBMS have similar 
> mechanism.
>
> This initialisation would be done by the connection pool whenever a 
> connection is checked out from the pool, or when a transaction is started. 
> That way, all triggers will have this information available to them, and 
> the same audit logic works for all clients, not just for jOOQ ones. I 
> strongly recommend following that path for the most robust and generic 
> solution.
>
> Hope this helps,
> Lukas
>
> On Sun, Feb 24, 2019 at 12:00 AM Kevin Embree <[email protected] 
> <javascript:>> wrote:
>
>> I think that may do the trick, thank you for pointing it out to me I 
>> missed that.
>>
>> On Saturday, February 23, 2019 at 1:05:47 PM UTC-5, Simon Niederberger 
>> wrote:
>>>
>>> Could this be what you're looking for? 
>>> https://www.jooq.org/doc/3.11/manual/sql-execution/crud-with-updatablerecords/crud-record-listener/
>>>
>>> On Saturday, February 23, 2019 at 12:21:33 PM UTC+1, Kevin Embree wrote:
>>>>
>>>> Database doesn't know what value to set application/JOOQ does.
>>>>
>>>> On Saturday, February 23, 2019 at 5:39:39 AM UTC-5, Simon Niederberger 
>>>> wrote:
>>>>>
>>>>> Wouldn't you be better off covering that requirement with a database 
>>>>> trigger?
>>>>>
>>>>> Simon
>>>>>
>>>>> On Friday, February 22, 2019 at 8:34:05 PM UTC+1, Kevin Embree wrote:
>>>>>>
>>>>>> Can anyone point me to an example of using JOOQs VisitListener to 
>>>>>> always set a field on inserts and updates.
>>>>>>
>>>>>> An example would be setting a user field as part of an audit.
>>>>>>
>>>>>> Thanks for your help,
>>>>>> -Kevin
>>>>>>
>>>>> -- 
>> 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] <javascript:>.
>> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to