diff --git a/jOOQ/src/main/java/org/jooq/ArrayRecord.java b/jOOQ/src/main/java/org/jooq/ArrayRecord.java index 6ab277316c..aa0a37473b 100644 --- a/jOOQ/src/main/java/org/jooq/ArrayRecord.java +++ b/jOOQ/src/main/java/org/jooq/ArrayRecord.java @@ -100,6 +100,8 @@ public interface ArrayRecord extends Store, Iterable { * JDBC {@link Array} * @throws DetachedException If this method is called on a detached * ArrayRecord + * @deprecated - 2.5.0 [#1638] - Do not reuse this method */ + @Deprecated Array createArray() throws SQLException, DetachedException; } diff --git a/jOOQ/src/main/java/org/jooq/impl/ArrayRecordImpl.java b/jOOQ/src/main/java/org/jooq/impl/ArrayRecordImpl.java index 6a6ed57a32..e50558fb5a 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ArrayRecordImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/ArrayRecordImpl.java @@ -223,6 +223,7 @@ public class ArrayRecordImpl extends AbstractStore implements ArrayRecord< } @Override + @Deprecated public final java.sql.Array createArray() throws SQLException { SQLDialect dialect = getConfiguration().getDialect(); diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultBindContext.java b/jOOQ/src/main/java/org/jooq/impl/DefaultBindContext.java index db52a43213..86f3775851 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultBindContext.java +++ b/jOOQ/src/main/java/org/jooq/impl/DefaultBindContext.java @@ -40,12 +40,16 @@ import static org.jooq.SQLDialect.POSTGRES; import static org.jooq.SQLDialect.SQLITE; import static org.jooq.SQLDialect.SQLSERVER; import static org.jooq.SQLDialect.SYBASE; +import static org.jooq.impl.Util.getDriverConnection; +import static org.jooq.tools.reflect.Reflect.on; import static org.jooq.util.postgres.PostgresUtils.toPGInterval; import java.math.BigDecimal; import java.math.BigInteger; +import java.sql.Array; import java.sql.Blob; import java.sql.Clob; +import java.sql.Connection; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.SQLException; @@ -314,7 +318,9 @@ class DefaultBindContext extends AbstractBindContext { } } else if (ArrayRecord.class.isAssignableFrom(type)) { - stmt.setArray(nextIndex(), ((ArrayRecord) value).createArray()); + Connection connection = getDriverConnection(this); + ArrayRecord arrayRecord = (ArrayRecord) value; + stmt.setArray(nextIndex(), on(connection).call("createARRAY", arrayRecord.getName(), arrayRecord.get()).get()); } else if (EnumType.class.isAssignableFrom(type)) { stmt.setString(nextIndex(), ((EnumType) value).getLiteral());