2017-03-21 15:16 GMT+01:00 Bill O'Neil <[email protected]>:

> Samir's use is exactly how I use the generated POJOs.
>
> Or does the fact that it is still "attached" bother you?
>
>
> This bothers me a little but can be worked around. I ran into some
> complications doing something similar in a previous project. The issue we
> ran into was some values were lazily loaded and the model was passed into
> our JSON serializer AFTER the connection was closed causing exceptions. I'm
> not sure if the same issue would arise here but its nice working with plain
> POJOs and knowing it won't be an issue. Also as Samir mentioned it can mess
> with serializers.
>

Oh, interesting, so you extended the jOOQ records with lazy loading
capabilities? :) OK, that wouldn't work then.


> That doesn't mean jOOQ should be responsible for such conveniences.
> However, if POJO generation was still supported you could also keep the
> RecordMapper generation to avoid reflection and do something like this.
>
>
> UserPojo user = getPojo();
>
> create.executeInsert(UserPojo.mapper().map(user));
> // Alternate API?
> create.executeInsert(user, UserPojo::mapper);
>
> user = create.selectFrom(Tables.USER).where(Tables.USER.ID.eq(1L)).
> fetchOne(UserPojo::mapper);
>
> RecordMappers could be in new classes instead of the DAO, as static fields
> / methods to the POJOs, or part of the generated Tables.
>
> Just a thought.
>

Yeah, indeed. Although again, I'm not sure if we'd just be moving an
unnecessary feature elsewhere rather than scratching the actual itch. If
the POJO is used almost uniquely as an intermediary for a serialisation
library, then something's not right. Better solutions would include:

1. jOOQ implements better serialisation capabilities (e.g. jOOQ 3.10
Record.formatJSON())
2. A better intermediary is used (e.g. java.util.Map)
3. etc.?

I guess, this will need some further thought... But generated POJOs *and*
RecordMappers seem to go the wrong direction, in my opinion... (I remember
the discussion, though)

-- 
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