diff --git a/jOOQ-test/src/org/jooq/test/_/testcases/FetchTests.java b/jOOQ-test/src/org/jooq/test/_/testcases/FetchTests.java index 254169da46..33e7be40f3 100644 --- a/jOOQ-test/src/org/jooq/test/_/testcases/FetchTests.java +++ b/jOOQ-test/src/org/jooq/test/_/testcases/FetchTests.java @@ -77,6 +77,7 @@ import java.util.Queue; import junit.framework.Assert; +import org.jooq.AttachableInternal; import org.jooq.Cursor; import org.jooq.DSLContext; import org.jooq.Field; @@ -95,6 +96,7 @@ import org.jooq.Select; import org.jooq.SelectQuery; import org.jooq.TableRecord; import org.jooq.UpdatableRecord; +import org.jooq.conf.Settings; import org.jooq.exception.DataAccessException; import org.jooq.exception.InvalidResultException; import org.jooq.exception.MappingException; @@ -1193,7 +1195,6 @@ extends BaseTest implements RecordMapper implements RecordMapper E attach(E attachable, Record record) { + // [#2869] Attach the mapped outcome if it is Attachable and if the context's + // Settings.attachRecords flag is set + if (attachable instanceof Attachable && record instanceof AttachableInternal) { + Attachable a = (Attachable) attachable; + AttachableInternal r = (AttachableInternal) record; + + if (Utils.attachRecords(r.configuration())) { + a.attach(r.configuration()); + } + } + + return attachable; + } } diff --git a/jOOQ/src/main/java/org/jooq/impl/Utils.java b/jOOQ/src/main/java/org/jooq/impl/Utils.java index 77c2b11947..3aabeec262 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Utils.java +++ b/jOOQ/src/main/java/org/jooq/impl/Utils.java @@ -405,7 +405,7 @@ final class Utils { return configuration(configuration).settings(); } - private static final boolean attachRecords(Configuration configuration) { + static final boolean attachRecords(Configuration configuration) { if (configuration != null) { Settings settings = configuration.settings(); @@ -1293,7 +1293,7 @@ final class Utils { */ static final Field escapeForLike(Object value, Configuration configuration) { if (value != null && value.getClass() == String.class) { - + /* [pro] xx xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx xxxxxxx x xxxxxx xxxxxxx x xxxxx x xxxxx