Replacing DAO functionality

38 views
Skip to first unread message

a...@mbcli.com

unread,
Jun 29, 2017, 10:52:23 AM6/29/17
to jOOQ User Group

Hello all, 

I'm trying to come up with a Factory that I can use to convert a POJO back to a Record so that we can apply some business rules and update the original record.

If I'm not reading the javadocs wrong DefaultRecordMapper and or custom RecordMapper will do the job, but I cannot for the life of me find an actual example of code that uses it to do the conversion from POJO to a Record.

A simple example of a DAO usage that we currently have, which we'd like to remove the dependency on.

      @Override
      public class update (Table table, User user) {
            MyTableDao dao = new MyTableDao(jooqConfiguration);
            table.setLastUpdatedBy(user.getId());
            dao.update(assessment);
      }

Thanks.

Rob Sargent

unread,
Jun 29, 2017, 7:34:26 PM6/29/17
to jooq...@googlegroups.com
I thought I saw a Record constructor that took a pojo?
> --
> 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.

Lukas Eder

unread,
Jun 30, 2017, 4:28:54 AM6/30/17
to jooq...@googlegroups.com
Hello,

The behaviour of DefaultRecordMapper can be inverted through the following methods:


If you want to revert the behaviour of a custom RecordMapper, you'll have a solution in jOOQ 3.10, as we'll (finally) support the new RecordUnmapper API: https://github.com/jOOQ/jOOQ/issues/2520.

Currently, you'll have to roll your own unmapping.

I hope this helps,
Lukas

a...@mbcli.com

unread,
Jun 30, 2017, 10:28:03 AM6/30/17
to jOOQ User Group

Now it makes sense why I cannot find any example.  Thanks.
Reply all
Reply to author
Forward
0 new messages