Hi Craig,

That's an interesting thought right there. The behaviour of the fetchInto()
method is specified by the DefaultRecordMapper:
http://www.jooq.org/javadoc/latest/org/jooq/impl/DefaultRecordMapper.html

Should DefaultRecordMapper consider if the target type implements
org.jooq.Attachable and take action accordingly? That might make sense and
be more consistent with the rest of the API. I have registered #2869 for
this:
https://github.com/jOOQ/jOOQ/issues/2869

For the time being, you could consider using fetchInto(Table) instead:
http://www.jooq.org/javadoc/latest/org/jooq/ResultQuery.html#fetchInto(org.jooq.Table)

This method would probably be faster anyway, since no reflection is
involved.

Cheers
Lukas


2013/11/29 <[email protected]>

> I have a generic sql builder, but it creates unattached records. I had to
> iterate over the returned results and attach them. Am I missing something?
>
> public <T extends UpdatableRecordImpl<?>> List<T> retrievedData(Class<T>
> clazz) {
>
>         Select<Record> sql = buildSql(clazz);
>         List<T> retVal = sql.fetchInto(clazz);
>     for (T t : retVal) {
> t.attach(_context.configuration());
>      }
>
>         return retVal;
> }
>
> Craig
>
> --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.

Reply via email to