diff --git a/jOOQ/src/main/java/org/jooq/FactoryOperations.java b/jOOQ/src/main/java/org/jooq/FactoryOperations.java index d4b9f78d48..4b04e44392 100644 --- a/jOOQ/src/main/java/org/jooq/FactoryOperations.java +++ b/jOOQ/src/main/java/org/jooq/FactoryOperations.java @@ -522,30 +522,6 @@ public interface FactoryOperations extends Configuration { @Support InsertValuesStep insertInto(Table into, Collection> fields); - /** - * Create a new DSL insert statement. - *

- * Example:

-     * Factory create = new Factory();
-     *
-     * create.insertInto(table, create.select(1))
-     *       .execute();
-     * 
- * - * @deprecated - 2.0.3 - Use any of these methods instead: - *
    - *
  • {@link #insertInto(Table)} and - * {@link InsertSetStep#select(Select)}
  • - * {@link #insertInto(Table, Field...)} and - * {@link InsertValuesStep#select(Select)}
  • - * {@link #insertInto(Table, Collection)} and - * {@link InsertValuesStep#select(Select)}
  • - *
- */ - @Deprecated - @Support - Insert insertInto(Table into, Select select); - /** * Create a new {@link UpdateQuery} * @@ -1083,19 +1059,6 @@ public interface FactoryOperations extends Configuration { @Support R fetchAny(Table table) throws DataAccessException; - /** - * Insert one record - *
INSERT INTO [table] ... VALUES [record] 
- * - * @return The number of inserted records - * @throws DataAccessException if something went wrong executing the query - * @deprecated - 2.5.0 [#1692] - Use {@link #executeInsert(TableRecord)} - * instead - */ - @Deprecated - @Support - > int executeInsert(Table table, R record) throws DataAccessException; - /** * Insert one record *

@@ -1113,59 +1076,6 @@ public interface FactoryOperations extends Configuration { @Support > int executeInsert(R record) throws DataAccessException; - /** - * Update a table - *

UPDATE [table] SET [modified values in record] 
- * - * @return The number of updated records - * @throws DataAccessException if something went wrong executing the query - * @deprecated - 2.5.0 [#1692] - This "mass" update is no longer supported - */ - @Deprecated - @Support - > int executeUpdate(Table table, R record) throws DataAccessException; - - /** - * Update a table - *
UPDATE [table] SET [modified values in record] WHERE [condition]
- * - * @return The number of updated records - * @throws DataAccessException if something went wrong executing the query - * @deprecated - 2.5.0 [#1692] - Use - * {@link #executeUpdate(TableRecord, Condition)} instead - */ - @Deprecated - @Support - , T> int executeUpdate(Table table, R record, Condition condition) - throws DataAccessException; - - /** - * Update one record in a table - *
UPDATE [table] SET [modified values in record]
- * - * @return The number of updated records - * @throws DataAccessException if something went wrong executing the query - * @deprecated - 2.5.0 [#1692] - This "mass" update is no longer supported - */ - @Deprecated - @Support - > int executeUpdateOne(Table table, R record) throws DataAccessException; - - /** - * Update one record in a table - *
UPDATE [table] SET [modified values in record] WHERE [condition]
- * - * @return The number of updated records - * @throws DataAccessException if something went wrong executing the query - * @deprecated - 2.5.0 [#1692] - The semantics of - * {@link #executeUpdate(TableRecord, Condition)} has changed. - * This method here is no longer necessary. - */ - @Deprecated - @Support - , T> int executeUpdateOne(Table table, R record, Condition condition) - throws DataAccessException; - /** * Update a table *
UPDATE [table] SET [modified values in record] WHERE [record is supplied record] 
@@ -1206,60 +1116,6 @@ public interface FactoryOperations extends Configuration { @Support , T> int executeDelete(R record, Condition condition) throws DataAccessException; - /** - * Delete records from a table
DELETE FROM [table]
- * - * @return The number of deleted records - * @throws DataAccessException if something went wrong executing the query - * @deprecated - 2.5.0 [#1692] - The semantics of - * {@link #executeDelete(TableRecord, Condition)} has changed. - * This method here is no longer necessary. - */ - @Deprecated - @Support - > int executeDelete(Table table) throws DataAccessException; - - /** - * Delete records from a table - *
DELETE FROM [table] WHERE [condition]
- * - * @return The number of deleted records - * @throws DataAccessException if something went wrong executing the query. - * @deprecated - 2.5.0 [#1692] - The semantics of - * {@link #executeDelete(TableRecord, Condition)} has changed. - * This method here is no longer necessary. - */ - @Deprecated - @Support - , T> int executeDelete(Table table, Condition condition) throws DataAccessException; - - /** - * Delete one record in a table
DELETE FROM [table]
- * - * @return The number of deleted records - * @throws DataAccessException if something went wrong executing the query - * @deprecated - 2.5.0 [#1692] - The semantics of - * {@link #executeDelete(TableRecord, Condition)} has changed. - * This method here is no longer necessary. - */ - @Deprecated - @Support - > int executeDeleteOne(Table table) throws DataAccessException; - - /** - * Delete one record in a table - *
DELETE FROM [table] WHERE [condition]
- * - * @return The number of deleted records - * @throws DataAccessException if something went wrong executing the query - * @deprecated - 2.5.0 [#1692] - The semantics of - * {@link #executeDelete(TableRecord, Condition)} has changed. - * This method here is no longer necessary. - */ - @Deprecated - @Support - , T> int executeDeleteOne(Table table, Condition condition) throws DataAccessException; - /** * Execute a new query holding plain SQL. *

diff --git a/jOOQ/src/main/java/org/jooq/MasterDataType.java b/jOOQ/src/main/java/org/jooq/MasterDataType.java deleted file mode 100644 index 03c9ea894d..0000000000 --- a/jOOQ/src/main/java/org/jooq/MasterDataType.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com - * All rights reserved. - * - * This software is licensed to you under the Apache License, Version 2.0 - * (the "License"); You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * . Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * . Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * . Neither the name "jOOQ" nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -package org.jooq; - -/** - * A type holding master data. - * - * @author Lukas Eder - * @deprecated - 2.5.0 [#1741] - This feature will be removed as of jOOQ 3.0 - */ -@Deprecated -public interface MasterDataType { - - /** - * Get the primary key value for this master data type - * - * @deprecated - 2.5.0 [#1741] - This feature will be removed as of jOOQ 3.0 - */ - @Deprecated - T getPrimaryKey(); -} diff --git a/jOOQ/src/main/java/org/jooq/UDT.java b/jOOQ/src/main/java/org/jooq/UDT.java index beb843e467..29b8a1ac4a 100644 --- a/jOOQ/src/main/java/org/jooq/UDT.java +++ b/jOOQ/src/main/java/org/jooq/UDT.java @@ -35,9 +35,6 @@ */ package org.jooq; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Map; /** * UDT definition @@ -66,21 +63,6 @@ public interface UDT> extends org.jooq.Type { @Override Class getRecordType(); - /** - * The complete type mapping for this UDT. - *

- * This method returns all types involved with this UDT, including nested - * types. The result can be used in {@link ResultSet#getObject(int, Map)} - * and similar methods. - * - * @see Schema#getTypeMapping() for the {@link Schema}'s complete type - * mapping - * @deprecated - 2.3.0 - Do not reuse this method. It will be moved to - * jOOQ's internals, soon - */ - @Deprecated - Map> getTypeMapping() throws SQLException; - /** * The UDT's data type as known to the database */ diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractDataType.java b/jOOQ/src/main/java/org/jooq/impl/AbstractDataType.java index 2eaa9b57b0..bd1608340b 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractDataType.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractDataType.java @@ -58,7 +58,6 @@ import org.jooq.Configuration; import org.jooq.Converter; import org.jooq.DataType; import org.jooq.EnumType; -import org.jooq.MasterDataType; import org.jooq.Result; import org.jooq.SQLDialect; import org.jooq.UDTRecord; @@ -263,9 +262,6 @@ public abstract class AbstractDataType implements DataType { else if (EnumType.class.isAssignableFrom(type)) { return Types.VARCHAR; } - else if (MasterDataType.class.isAssignableFrom(type)) { - return Types.BIGINT; - } else if (UDTRecord.class.isAssignableFrom(type)) { return Types.STRUCT; } @@ -450,7 +446,6 @@ public abstract class AbstractDataType implements DataType { // jOOQ data types are handled here if (EnumType.class.isAssignableFrom(type) || UDTRecord.class.isAssignableFrom(type) || - MasterDataType.class.isAssignableFrom(type) || ArrayRecord.class.isAssignableFrom(type)) { for (SQLDialect d : SQLDialect.values()) { diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultBindContext.java b/jOOQ/src/main/java/org/jooq/impl/DefaultBindContext.java index 4928fdb7a0..66db206a3b 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultBindContext.java +++ b/jOOQ/src/main/java/org/jooq/impl/DefaultBindContext.java @@ -116,7 +116,7 @@ class DefaultBindContext extends AbstractBindContext { } @Override - @SuppressWarnings({ "unchecked", "rawtypes", "deprecation" }) + @SuppressWarnings({ "unchecked", "rawtypes" }) protected final BindContext bindValue0(Object value, Class type) throws SQLException { SQLDialect dialect = configuration.getDialect(); @@ -324,10 +324,6 @@ class DefaultBindContext extends AbstractBindContext { else if (EnumType.class.isAssignableFrom(type)) { stmt.setString(nextIndex(), ((EnumType) value).getLiteral()); } - else if (org.jooq.MasterDataType.class.isAssignableFrom(type)) { - Object primaryKey = ((org.jooq.MasterDataType) value).getPrimaryKey(); - bindValue(primaryKey, primaryKey.getClass()); - } else { try { // [#1544] Set the local configuration, in case an array needs diff --git a/jOOQ/src/main/java/org/jooq/impl/Factory.java b/jOOQ/src/main/java/org/jooq/impl/Factory.java index 5bdea20fea..1dc35dcc91 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Factory.java +++ b/jOOQ/src/main/java/org/jooq/impl/Factory.java @@ -98,7 +98,6 @@ import org.jooq.FactoryOperations; import org.jooq.Field; import org.jooq.FieldProvider; import org.jooq.GroupConcatOrderByStep; -import org.jooq.Insert; import org.jooq.InsertQuery; import org.jooq.InsertSetStep; import org.jooq.InsertValuesStep; @@ -273,34 +272,6 @@ public class Factory implements FactoryOperations { this(null, null, dialect, null, null, null); } - /** - * Create a factory with a connection, a dialect and a schema mapping - * configured. - *

- * If you provide a JDBC connection to a jOOQ Factory, jOOQ will use that - * connection for creating statements, but it will never call any of these - * methods: - *

    - *
  • {@link Connection#commit()}
  • - *
  • {@link Connection#rollback()}
  • - *
  • {@link Connection#close()}
  • - *
- * Use this constructor if you want to handle transactions directly on the - * connection. - * - * @param connection The connection to use with objects created from this - * factory - * @param dialect The dialect to use with objects created from this factory - * @param mapping The schema mapping to use with objects created from this - * factory - * @deprecated - 2.0.5 - Use - * {@link #Factory(Connection, SQLDialect, Settings)} instead - */ - @Deprecated - public Factory(Connection connection, SQLDialect dialect, org.jooq.SchemaMapping mapping) { - this(null, connection, dialect, null, null, null); - } - /** * Create a factory with a connection, a dialect and settings configured. *

@@ -2004,15 +1975,6 @@ public class Factory implements FactoryOperations { return new InsertImpl(this, into, fields); } - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public final Insert insertInto(Table into, Select select) { - return new InsertSelectQueryImpl(this, into, into.getFields(), select); - } - /** * {@inheritDoc} */ @@ -6210,89 +6172,6 @@ public class Factory implements FactoryOperations { // XXX Literals // ------------------------------------------------------------------------- - /** - * Get a typed Field for a literal. - *

- * This is similar as calling {@link #field(String)}. A field without bind - * variables will be generated. - *

- * NOTE: When inserting plain SQL into jOOQ objects, you must - * guarantee syntax integrity. You may also create the possibility of - * malicious SQL injection. Be sure to properly use bind variables and/or - * escape literals when concatenated into SQL clauses! - * - * @param The generic field type - * @param literal The literal - * @return The literal as a field - * @deprecated - 2.3.0 - Use {@link #field(String)}, or - * {@link #inline(Object)} instead. - */ - @Deprecated - @SuppressWarnings("unchecked") - @Support - public static Field literal(T literal) { - if (literal == null) { - return (Field) NULL(); - } - else { - return literal(literal, (Class) literal.getClass()); - } - } - - /** - * Get a typed Field for a literal. - *

- * This is similar as calling {@link #field(String)}. A field without bind - * variables will be generated. - *

- * NOTE: When inserting plain SQL into jOOQ objects, you must - * guarantee syntax integrity. You may also create the possibility of - * malicious SQL injection. Be sure to properly use bind variables and/or - * escape literals when concatenated into SQL clauses! - * - * @param The generic field type - * @param literal The literal - * @param type The literal's data type - * @return The literal as a field - * @deprecated - 2.3.0 - Use {@link #field(String, Class)}, or - * {@link #inline(Object, Class)} instead. - */ - @Deprecated - @Support - public static Field literal(Object literal, Class type) { - return literal(literal, getDataType(type)); - } - - /** - * Get a typed Field for a literal. - *

- * This is similar as calling {@link #field(String)}. A field without bind - * variables will be generated. - *

- * NOTE: When inserting plain SQL into jOOQ objects, you must - * guarantee syntax integrity. You may also create the possibility of - * malicious SQL injection. Be sure to properly use bind variables and/or - * escape literals when concatenated into SQL clauses! - * - * @param The generic field type - * @param literal The literal - * @param type The literal's data type - * @return The literal as a field - * @deprecated - 2.3.0 - Use {@link #field(String, DataType)}, or - * {@link #inline(Object, DataType)} instead. - */ - @Deprecated - @SuppressWarnings("unchecked") - @Support - public static Field literal(Object literal, DataType type) { - if (literal == null) { - return (Field) NULL(); - } - else { - return field(literal.toString(), type); - } - } - /** * Get the null field */ @@ -6457,17 +6336,6 @@ public class Factory implements FactoryOperations { return filterOne(selectFrom(table).limit(1).fetch()); } - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public final > int executeInsert(Table table, R record) { - InsertQuery insert = insertQuery(table); - insert.setRecord(record); - return insert.execute(); - } - /** * {@inheritDoc} */ @@ -6478,45 +6346,6 @@ public class Factory implements FactoryOperations { return insert.execute(); } - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public final > int executeUpdate(Table table, R record) { - return executeUpdate(table, record, trueCondition()); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public final , T> int executeUpdate(Table table, R record, Condition condition) { - UpdateQuery update = updateQuery(table); - update.addConditions(condition); - update.setRecord(record); - return update.execute(); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public final > int executeUpdateOne(Table table, R record) { - return filterUpdateOne(executeUpdate(table, record)); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public final , T> int executeUpdateOne(Table table, R record, Condition condition) { - return filterUpdateOne(executeUpdate(table, record, condition)); - } - /** * {@inheritDoc} */ @@ -6559,47 +6388,6 @@ public class Factory implements FactoryOperations { return delete.execute(); } - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public final > int executeDelete(Table table) { - return executeDelete(table, trueCondition()); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public final , T> int executeDelete(Table table, Condition condition) - throws DataAccessException{ - DeleteQuery delete = deleteQuery(table); - delete.addConditions(condition); - return delete.execute(); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public final > int executeDeleteOne(Table table) { - return executeDeleteOne(table, trueCondition()); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public final , T> int executeDeleteOne(Table table, Condition condition) { - DeleteQuery delete = deleteQuery(table); - delete.addConditions(condition); - return filterDeleteOne(delete.execute()); - } - /** * Get the default data type for the {@link Factory}'s underlying * {@link SQLDialect} and a given Java type. @@ -6634,14 +6422,6 @@ public class Factory implements FactoryOperations { // XXX Internals // ------------------------------------------------------------------------- - private static int filterDeleteOne(int i) { - return filterOne(i, "deleted"); - } - - private static int filterUpdateOne(int i) { - return filterOne(i, "updated"); - } - private static int filterOne(int i, String action) { if (i <= 1) { return i; diff --git a/jOOQ/src/main/java/org/jooq/impl/FactoryProxy.java b/jOOQ/src/main/java/org/jooq/impl/FactoryProxy.java deleted file mode 100644 index eb6020fc3e..0000000000 --- a/jOOQ/src/main/java/org/jooq/impl/FactoryProxy.java +++ /dev/null @@ -1,714 +0,0 @@ -/** - * Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com - * All rights reserved. - * - * This software is licensed to you under the Apache License, Version 2.0 - * (the "License"); You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * . Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * . Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * . Neither the name "jOOQ" nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -package org.jooq.impl; - -import java.lang.reflect.Constructor; -import java.math.BigInteger; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.Savepoint; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import javax.sql.DataSource; - -import org.jooq.Attachable; -import org.jooq.Batch; -import org.jooq.BatchBindStep; -import org.jooq.Condition; -import org.jooq.Cursor; -import org.jooq.DeleteQuery; -import org.jooq.DeleteWhereStep; -import org.jooq.FactoryOperations; -import org.jooq.Field; -import org.jooq.Insert; -import org.jooq.InsertQuery; -import org.jooq.InsertSetStep; -import org.jooq.InsertValuesStep; -import org.jooq.LoaderOptionsStep; -import org.jooq.MergeKeyStep; -import org.jooq.MergeUsingStep; -import org.jooq.Query; -import org.jooq.QueryPart; -import org.jooq.Record; -import org.jooq.Result; -import org.jooq.ResultQuery; -import org.jooq.SQLDialect; -import org.jooq.Schema; -import org.jooq.Select; -import org.jooq.SelectQuery; -import org.jooq.SelectSelectStep; -import org.jooq.Sequence; -import org.jooq.SimpleSelectQuery; -import org.jooq.SimpleSelectWhereStep; -import org.jooq.Table; -import org.jooq.TableLike; -import org.jooq.TableRecord; -import org.jooq.Truncate; -import org.jooq.UDT; -import org.jooq.UDTRecord; -import org.jooq.UpdatableRecord; -import org.jooq.UpdateQuery; -import org.jooq.UpdateSetStep; -import org.jooq.conf.Settings; -import org.jooq.exception.DataAccessException; - -/** - * Thread safe proxy for {@link Factory}. - *

- * The FactoryProxy operates as a thread-safe proxy for jOOQ's - * {@link Factory} objects. Instead of wrapping JDBC {@link Connection} objects, - * the FactoryProxy wraps a transaction-aware {@link DataSource} - * and creates a new Factory with a new Connection - * every time you use any of the operations from {@link FactoryOperations} - *

- * Refer to the jOOQ manual to see possible operation modes for jOOQ with - * Spring. Note that this implementation of a FactoryProxy might be - * re-designed in jOOQ 3.0. Please consider this functionality as being - * EXPERIMENTAL - * - * @author Sergey Epik - * @author Lukas Eder - * @deprecated - Use the newly {@link DataSource}-enabled {@link Factory} - * constructors instead, e.g. - * {@link Factory#Factory(DataSource, SQLDialect)} or - * {@link Factory#Factory(DataSource, SQLDialect, Settings)} - */ -@Deprecated -public final class FactoryProxy implements FactoryOperations { - - /** - * Generated UID - */ - private static final long serialVersionUID = -8475057043526340066L; - - private transient DataSource dataSource; - private SQLDialect dialect; - private Settings settings; - - // ------------------------------------------------------------------------- - // Injected configuration - // ------------------------------------------------------------------------- - - public final void setDialect(SQLDialect dialect) { - this.dialect = dialect; - } - - public final void setSettings(Settings settings) { - this.settings = settings; - } - - @Override - public final void setDataSource(DataSource dataSource) { - this.dataSource = dataSource; - } - - @Override - public final DataSource getDataSource() { - return this.dataSource; - } - - // ------------------------------------------------------------------------- - // Configuration API - // ------------------------------------------------------------------------- - - @Override - public final SQLDialect getDialect() { - return dialect; - } - - @Override - @Deprecated - public final org.jooq.SchemaMapping getSchemaMapping() { - return null; - } - - @Override - public final Settings getSettings() { - return settings; - } - - @Override - public final Connection getConnection() { - return getDelegate().getConnection(); - } - - @Override - public final void setConnection(Connection connection) { - getDelegate().setConnection(connection); - } - - @Override - public final Map getData() { - return getDelegate().getData(); - } - - @Override - public final Object getData(String key) { - return getDelegate().getData(key); - } - - @Override - public final Object setData(String key, Object value) { - return getDelegate().setData(key, value); - } - - // ------------------------------------------------------------------------- - // XXX FactoryOperations API - // ------------------------------------------------------------------------- - - @Override - public final > LoaderOptionsStep loadInto(Table table) { - return getDelegate().loadInto(table); - } - - @Override - public final String render(QueryPart part) { - return getDelegate().render(part); - } - - @Override - public final String renderNamedParams(QueryPart part) { - return getDelegate().renderNamedParams(part); - } - - @Override - public final String renderInlined(QueryPart part) { - return getDelegate().renderInlined(part); - } - - @Override - public final void attach(Attachable... attachables) { - getDelegate().attach(attachables); - } - - @Override - public final void attach(Collection attachables) { - getDelegate().attach(attachables); - } - - @Override - public final Query query(String sql) { - return getDelegate().query(sql); - } - - @Override - public final Query query(String sql, Object... bindings) { - return getDelegate().query(sql, bindings); - } - - @Override - public final Query query(String sql, QueryPart... parts) { - return getDelegate().query(sql, parts); - } - - @Override - public final SimpleSelectWhereStep selectFrom(Table table) { - return getDelegate().selectFrom(table); - } - - @Override - public final SelectSelectStep select(Field... fields) { - return getDelegate().select(fields); - } - - @Override - public final SelectSelectStep selectZero() { - return getDelegate().selectZero(); - } - - @Override - public final SelectSelectStep selectOne() { - return getDelegate().selectOne(); - } - - @Override - public final SelectSelectStep selectCount() { - return getDelegate().selectCount(); - } - - @Override - public final SelectSelectStep selectDistinct(Field... fields) { - return getDelegate().selectDistinct(fields); - } - - @Override - public final SelectSelectStep select(Collection> fields) { - return getDelegate().select(fields); - } - - @Override - public final SelectSelectStep selectDistinct(Collection> fields) { - return getDelegate().selectDistinct(fields); - } - - @Override - public final SelectQuery selectQuery() { - return getDelegate().selectQuery(); - } - - @Override - public final SimpleSelectQuery selectQuery(TableLike table) { - return getDelegate().selectQuery(table); - } - - @Override - public final InsertQuery insertQuery(Table into) { - return getDelegate().insertQuery(into); - } - - @Override - public final InsertSetStep insertInto(Table into) { - return getDelegate().insertInto(into); - } - - @Override - public final InsertValuesStep insertInto(Table into, Field... fields) { - return getDelegate().insertInto(into, fields); - } - - @Override - public final InsertValuesStep insertInto(Table into, Collection> fields) { - return getDelegate().insertInto(into, fields); - } - - @Override - @Deprecated - public final Insert insertInto(Table into, Select select) { - return getDelegate().insertInto(into, select); - } - - @Override - public final UpdateQuery updateQuery(Table table) { - return getDelegate().updateQuery(table); - } - - @Override - public final UpdateSetStep update(Table table) { - return getDelegate().update(table); - } - - @Override - public final MergeUsingStep mergeInto(Table table) { - return getDelegate().mergeInto(table); - } - - @Override - public final MergeKeyStep mergeInto(Table table, Field... fields) { - return getDelegate().mergeInto(table, fields); - } - - @Override - public final MergeKeyStep mergeInto(Table table, Collection> fields) { - return getDelegate().mergeInto(table, fields); - } - - @Override - public final DeleteQuery deleteQuery(Table table) { - return getDelegate().deleteQuery(table); - } - - @Override - public final DeleteWhereStep delete(Table table) { - return getDelegate().delete(table); - } - - @Override - public final Batch batch(Query... queries) { - return getDelegate().batch(queries); - } - - @Override - public final Batch batch(Collection queries) { - return getDelegate().batch(queries); - } - - @Override - public final BatchBindStep batch(Query query) { - return getDelegate().batch(query); - } - - @Override - public final Batch batchStore(UpdatableRecord... records) { - return getDelegate().batchStore(records); - } - - @Override - public final Batch batchStore(Collection> records) { - return getDelegate().batchStore(records); - } - - @Override - public final Truncate truncate(Table table) { - return getDelegate().truncate(table); - } - - @Override - public final > R newRecord(UDT type) { - return getDelegate().newRecord(type); - } - - @Override - public final > R newRecord(Table table) { - return getDelegate().newRecord(table); - } - - @Override - public final > R newRecord(Table table, Object source) { - return getDelegate().newRecord(table, source); - } - - @Override - public final Result fetch(ResultSet rs) { - return getDelegate().fetch(rs); - } - - @Override - public final Cursor fetchLazy(ResultSet rs) { - return getDelegate().fetchLazy(rs); - } - - @Override - public final Result fetchFromCSV(String string) { - return null; - } - - @Override - public final Result fetchFromCSV(String string, char delimiter) { - return null; - } - - @Override - public final Result fetch(String sql) { - return getDelegate().fetch(sql); - } - - @Override - public final Result fetch(String sql, Object... bindings) { - return getDelegate().fetch(sql, bindings); - } - - @Override - public final Result fetch(String sql, QueryPart... parts) { - return getDelegate().fetch(sql, parts); - } - - @Override - public final Cursor fetchLazy(String sql) { - return getDelegate().fetchLazy(sql); - } - - @Override - public final Cursor fetchLazy(String sql, Object... bindings) { - return getDelegate().fetchLazy(sql, bindings); - } - - @Override - public final Cursor fetchLazy(String sql, QueryPart... parts) { - return getDelegate().fetchLazy(sql, parts); - } - - @Override - public final List> fetchMany(String sql) { - return getDelegate().fetchMany(sql); - } - - @Override - public final List> fetchMany(String sql, Object... bindings) { - return getDelegate().fetchMany(sql, bindings); - } - - @Override - public final List> fetchMany(String sql, QueryPart... parts) { - return getDelegate().fetchMany(sql, parts); - } - - @Override - public final Record fetchOne(String sql) { - return getDelegate().fetchOne(sql); - } - - @Override - public final Record fetchOne(String sql, Object... bindings) { - return getDelegate().fetchOne(sql, bindings); - } - - @Override - public final Record fetchOne(String sql, QueryPart... parts) { - return getDelegate().fetchOne(sql, parts); - } - - @Override - public final int execute(String sql) { - return getDelegate().execute(sql); - } - - @Override - public final int execute(String sql, Object... bindings) { - return getDelegate().execute(sql, bindings); - } - - @Override - public final int execute(String sql, QueryPart... parts) { - return getDelegate().execute(sql, parts); - } - - @Override - public final ResultQuery resultQuery(String sql) { - return getDelegate().resultQuery(sql); - } - - @Override - public final ResultQuery resultQuery(String sql, Object... bindings) { - return getDelegate().resultQuery(sql, bindings); - } - - @Override - public final ResultQuery resultQuery(String sql, QueryPart... parts) { - return getDelegate().resultQuery(sql, parts); - } - - @Override - public final BigInteger lastID() { - return getDelegate().lastID(); - } - - @Override - public final T nextval(Sequence sequence) { - return getDelegate().nextval(sequence); - } - - @Override - public final T currval(Sequence sequence) { - return getDelegate().currval(sequence); - } - - @Override - public final int use(Schema schema) { - return getDelegate().use(schema); - } - - @Override - public final int use(String schema) { - return getDelegate().use(schema); - } - - @Override - public final Result fetch(Table table) { - return getDelegate().fetch(table); - } - - @Override - public final Result fetch(Table table, Condition condition) { - return getDelegate().fetch(table, condition); - } - - @Override - public final R fetchOne(Table table) { - return getDelegate().fetchOne(table); - } - - @Override - public final R fetchOne(Table table, Condition condition) { - return getDelegate().fetchOne(table, condition); - } - - @Override - public final R fetchAny(Table table) { - return getDelegate().fetchAny(table); - } - - @Override - @Deprecated - public final > int executeInsert(Table table, R record) { - return getDelegate().executeInsert(table, record); - } - - @Override - public final > int executeInsert(R record) { - return getDelegate().executeInsert(record); - } - - @Override - @Deprecated - public final > int executeUpdate(Table table, R record) { - return getDelegate().executeUpdate(table, record); - } - - @Override - @Deprecated - public final , T> int executeUpdate(Table table, R record, Condition condition) { - return getDelegate().executeUpdate(table, record, condition); - } - - @Override - @Deprecated - public final > int executeUpdateOne(Table table, R record) { - return getDelegate().executeUpdateOne(table, record); - } - - @Override - @Deprecated - public final , T> int executeUpdateOne(Table table, R record, Condition condition) { - return getDelegate().executeUpdateOne(table, record, condition); - } - - @Override - public final > int executeUpdate(R record) { - return getDelegate().executeUpdate(record); - } - - @Override - public final , T> int executeUpdate(R record, Condition condition) { - return getDelegate().executeUpdate(record, condition); - } - - @Override - public final > int executeDelete(R record) { - return getDelegate().executeDelete(record); - } - - @Override - public final , T> int executeDelete(R record, Condition condition) { - return getDelegate().executeDelete(record, condition); - } - - @Override - @Deprecated - public final > int executeDelete(Table table) { - return getDelegate().executeDelete(table); - } - - @Override - @Deprecated - public final , T> int executeDelete(Table table, Condition condition) { - return getDelegate().executeDelete(table, condition); - } - - @Override - @Deprecated - public final > int executeDeleteOne(Table table) { - return getDelegate().executeDeleteOne(table); - } - - @Override - @Deprecated - public final , T> int executeDeleteOne(Table table, Condition condition) { - return getDelegate().executeDeleteOne(table, condition); - } - - @Override - public final int getTransactionIsolation() { - return getDelegate().getTransactionIsolation(); - } - - @Override - public final void setTransactionIsolation(int level) { - getDelegate().setTransactionIsolation(level); - } - - @Override - public final int getHoldability() { - return getDelegate().getHoldability(); - } - - @Override - public final void setHoldability(int holdability) { - getDelegate().setHoldability(holdability); - } - - @Override - public final boolean getAutoCommit() { - return getDelegate().getAutoCommit(); - } - - @Override - public final void setAutoCommit(boolean autoCommit) { - getDelegate().setAutoCommit(autoCommit); - } - - @Override - public final void releaseSavepoint(Savepoint savepoint) { - getDelegate().releaseSavepoint(savepoint); - } - - @Override - public final Savepoint setSavepoint(String name) { - return getDelegate().setSavepoint(name); - } - - @Override - public final Savepoint setSavepoint() { - return getDelegate().setSavepoint(); - } - - @Override - public final void rollback(Savepoint savepoint) { - getDelegate().rollback(savepoint); - } - - @Override - public final void rollback() { - getDelegate().rollback(); - } - - @Override - public final void commit() { - getDelegate().commit(); - } - - private FactoryOperations getDelegate() { - if (dataSource == null || dialect == null) { - throw new DataAccessException("Both dataSource and dialect properties should be set"); - } - try { - Class clazz = getDialect().getFactory(); - Connection con = getDataSource().getConnection(); - - Constructor constructor; - if (settings == null) { - constructor = clazz.getConstructor(Connection.class); - return constructor.newInstance(con); - } else { - constructor = clazz.getConstructor(Connection.class, Settings.class); - return constructor.newInstance(con, settings); - } - } catch (Exception exc) { - throw new DataAccessException("Failed to create jOOQ Factory", exc); - } - } -} diff --git a/jOOQ/src/main/java/org/jooq/impl/FieldTypeHelper.java b/jOOQ/src/main/java/org/jooq/impl/FieldTypeHelper.java index cf5a22d7ac..5ab911c6b7 100644 --- a/jOOQ/src/main/java/org/jooq/impl/FieldTypeHelper.java +++ b/jOOQ/src/main/java/org/jooq/impl/FieldTypeHelper.java @@ -62,7 +62,6 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.List; -import java.util.Map; import java.util.regex.Pattern; import org.jooq.ArrayRecord; @@ -72,7 +71,6 @@ import org.jooq.DataType; import org.jooq.EnumType; import org.jooq.ExecuteContext; import org.jooq.Field; -import org.jooq.MasterDataType; import org.jooq.Result; import org.jooq.SQLDialect; import org.jooq.UDTRecord; @@ -108,7 +106,6 @@ import org.jooq.util.sybase.SybaseDataType; * * @author Lukas Eder */ -@SuppressWarnings("deprecation") public final class FieldTypeHelper { private static final int LONG_PRECISION = String.valueOf(Long.MAX_VALUE).length(); @@ -223,9 +220,6 @@ public final class FieldTypeHelper { else if (EnumType.class.isAssignableFrom(type)) { return getEnumType(type, stream.readString()); } - else if (MasterDataType.class.isAssignableFrom(type)) { - return (T) getMasterDataType(type, stream.readObject()); - } else if (UDTRecord.class.isAssignableFrom(type)) { return (T) stream.readObject(); } @@ -359,10 +353,6 @@ public final class FieldTypeHelper { else if (EnumType.class.isAssignableFrom(type)) { stream.writeString(((EnumType) value).getLiteral()); } - else if (MasterDataType.class.isAssignableFrom(type)) { - Object key = ((MasterDataType) value).getPrimaryKey(); - writeToSQLOutput(stream, key.getClass(), key); - } else if (UDTRecord.class.isAssignableFrom(type)) { stream.writeObject((UDTRecord) value); } @@ -371,14 +361,6 @@ public final class FieldTypeHelper { } } - /** - * @deprecated - 2.3.0 - Do not reuse this method - */ - @Deprecated - public static void writeToSQLOutput(SQLOutput stream, Class type, T value) throws SQLException { - writeToSQLOutput(stream, type, null, value); - } - static U getFromResultSet(ExecuteContext ctx, Field field, int index) throws SQLException { @@ -516,9 +498,6 @@ public final class FieldTypeHelper { else if (EnumType.class.isAssignableFrom(type)) { return getEnumType(type, rs.getString(index)); } - else if (MasterDataType.class.isAssignableFrom(type)) { - return (T) getMasterDataType(type, rs.getObject(index)); - } else if (UDTRecord.class.isAssignableFrom(type)) { switch (ctx.getDialect()) { case POSTGRES: @@ -671,18 +650,6 @@ public final class FieldTypeHelper { } } - /** - * @deprecated - 2.3.0 - Do not reuse this method - */ - @Deprecated - public static Map> getTypeMapping(Class udtType) throws SQLException { - try { - return ((UDTRecord) udtType.newInstance()).getUDT().getTypeMapping(); - } catch (Exception e) { - throw new SQLException("Cannot retrieve type mapping for " + udtType, e); - } - } - private static T checkWasNull(SQLInput stream, T value) throws SQLException { return stream.wasNull() ? null : value; } @@ -715,26 +682,6 @@ public final class FieldTypeHelper { return null; } - - static MasterDataType getMasterDataType(Class type, Object primaryKey) throws SQLException { - try { - Object[] values = (Object[]) type.getMethod("values").invoke(type); - - for (Object value : values) { - MasterDataType result = (MasterDataType) value; - - if (String.valueOf(primaryKey).equals(String.valueOf(result.getPrimaryKey()))) { - return result; - } - } - } - catch (Exception e) { - throw new SQLException("Unknown enum literal found : " + primaryKey); - } - - return null; - } - @SuppressWarnings("unchecked") public static T getFromStatement(ExecuteContext ctx, Class type, int index) throws SQLException { CallableStatement stmt = (CallableStatement) ctx.statement(); @@ -835,9 +782,6 @@ public final class FieldTypeHelper { else if (EnumType.class.isAssignableFrom(type)) { return getEnumType(type, stmt.getString(index)); } - else if (MasterDataType.class.isAssignableFrom(type)) { - return (T) getMasterDataType(type, stmt.getString(index)); - } else if (UDTRecord.class.isAssignableFrom(type)) { switch (ctx.getDialect()) { case POSTGRES: @@ -1063,9 +1007,6 @@ public final class FieldTypeHelper { else if (EnumType.class.isAssignableFrom(type)) { return getEnumType(type, string); } - else if (MasterDataType.class.isAssignableFrom(type)) { - return (T) getMasterDataType(type, string); - } else if (UDTRecord.class.isAssignableFrom(type)) { return (T) pgNewUDTRecord(type, string); } diff --git a/jOOQ/src/main/java/org/jooq/impl/UDTImpl.java b/jOOQ/src/main/java/org/jooq/impl/UDTImpl.java index 164d07c67f..105180263b 100644 --- a/jOOQ/src/main/java/org/jooq/impl/UDTImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/UDTImpl.java @@ -35,13 +35,10 @@ */ package org.jooq.impl; -import java.sql.SQLException; -import java.util.HashMap; import java.util.Map; import org.jooq.BindContext; import org.jooq.DataType; -import org.jooq.Field; import org.jooq.QueryPart; import org.jooq.Record; import org.jooq.RenderContext; @@ -86,24 +83,6 @@ public class UDTImpl> extends AbstractFieldProviderQueryP throw new UnsupportedOperationException(); } - @Override - @Deprecated - public final synchronized Map> getTypeMapping() throws SQLException { - if (typeMapping == null) { - typeMapping = new HashMap>(); - typeMapping.put(getName(), getRecordType()); - - // Recursively add nested UDT types - for (Field field : getFieldList()) { - if (UDTRecord.class.isAssignableFrom(field.getType())) { - typeMapping.putAll(FieldTypeHelper.getTypeMapping(field.getType())); - } - } - } - - return typeMapping; - } - @Override public final DataType getDataType() { if (type == null) { diff --git a/jOOQ/src/main/java/org/jooq/impl/Val.java b/jOOQ/src/main/java/org/jooq/impl/Val.java index 48011b6a45..798dabb5d0 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Val.java +++ b/jOOQ/src/main/java/org/jooq/impl/Val.java @@ -141,14 +141,13 @@ class Val extends AbstractField implements Param { } } - @SuppressWarnings("deprecation") private boolean shouldCast(RenderContext context) { // In default mode, casting is only done when parameters are NOT inlined if (!isInline(context)) { // Generated enums should not be cast... - if (!(getValue() instanceof EnumType) && !(getValue() instanceof org.jooq.MasterDataType)) { + if (!(getValue() instanceof EnumType)) { switch (context.getDialect()) { // These dialects can hardly detect the type of a bound constant. @@ -324,7 +323,7 @@ class Val extends AbstractField implements Param { /** * Inlining abstraction */ - @SuppressWarnings({ "unchecked", "rawtypes", "deprecation" }) + @SuppressWarnings({ "unchecked", "rawtypes" }) private void toSQL(RenderContext context, Object val, Class type) { SQLDialect dialect = context.getDialect(); @@ -486,9 +485,6 @@ class Val extends AbstractField implements Param { else if (EnumType.class.isAssignableFrom(type)) { toSQL(context, ((EnumType) val).getLiteral()); } - else if (org.jooq.MasterDataType.class.isAssignableFrom(type)) { - toSQL(context, ((org.jooq.MasterDataType) val).getPrimaryKey()); - } else if (UDTRecord.class.isAssignableFrom(type)) { context.sql("[UDT]"); }