On Sat, Jun 1, 2024 at 8:55 PM Dominik Hirt <[email protected]>
wrote:

> private Boolean hasModifiedBy(Record dbRecord) {
>    Boolean result = Boolean.FALSE;
>
>    Method[] methods = dbRecord.getClass().getDeclaredMethods();
>    for (Method method : methods) {
>      if (method.getName().equals("getModifiedBy")) {
>        result = Boolean.TRUE;
>        break;
>      }
>    }
>    return result;
> }
>
> }
>

You could let your generated records extend an interface declaring the
relevant methods via a generator strategy:

- Programmatic:
https://www.jooq.org/doc/latest/manual/code-generation/codegen-generatorstrategy/
- Configurative:
https://www.jooq.org/doc/latest/manual/code-generation/codegen-matcherstrategy/

That would allow for avoiding reflection.

Though note, that jOOQ supports auditing out of the box, and will ensure it
applies also to non-UpdatableRecord interactions, including all INSERT,
UPDATE, and MERGE statements that run by jOOQ's API:
https://www.jooq.org/doc/latest/manual/code-generation/codegen-advanced/codegen-config-database/codegen-database-forced-types/codegen-database-forced-types-audit/

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/CAB4ELO5YNbcKL9ZM67mfEruCdfpxE3Md7kYrQ3nXFV2diLLpaw%40mail.gmail.com.

Reply via email to