From 0cdbbb9a116faa8624edb8ab5bed5b12cd80365d Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Wed, 25 Apr 2012 19:27:03 +0200 Subject: [PATCH] Applied Sergey's patch to support Settings from FactoryProxy --- .../main/java/org/jooq/impl/FactoryProxy.java | 37 ++++++------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/impl/FactoryProxy.java b/jOOQ/src/main/java/org/jooq/impl/FactoryProxy.java index 1c4bbdec62..c2da7bb40a 100644 --- a/jOOQ/src/main/java/org/jooq/impl/FactoryProxy.java +++ b/jOOQ/src/main/java/org/jooq/impl/FactoryProxy.java @@ -83,7 +83,6 @@ import org.jooq.UpdateQuery; import org.jooq.UpdateSetStep; import org.jooq.conf.Settings; import org.jooq.exception.DataAccessException; -import org.jooq.tools.JooqLogger; /** * Thread safe proxy for {@link Factory}. @@ -104,15 +103,11 @@ public final class FactoryProxy implements FactoryOperations { /** * Generated UID */ - private static final long serialVersionUID = -8475057043526340066L; + private static final long serialVersionUID = -8475057043526340066L; - private static JooqLogger log = JooqLogger.getLogger(FactoryProxy.class); - private transient DataSource dataSource; - private SQLDialect dialect; - - @SuppressWarnings("deprecation") - private org.jooq.SchemaMapping schemaMapping; - private Settings settings; + private transient DataSource dataSource; + private SQLDialect dialect; + private Settings settings; // ------------------------------------------------------------------------- // Injected configuration @@ -122,13 +117,6 @@ public final class FactoryProxy implements FactoryOperations { this.dialect = dialect; } - @SuppressWarnings("deprecation") - public final void setSchemaMapping(org.jooq.SchemaMapping schemaMapping) { - this.schemaMapping = schemaMapping; - - log.warn("DEPRECATION", "org.jooq.SchemaMapping is deprecated as of jOOQ 2.0.5. Consider using jOOQ's runtime configuration org.jooq.conf.Settings instead"); - } - public final void setSettings(Settings settings) { this.settings = settings; } @@ -153,7 +141,7 @@ public final class FactoryProxy implements FactoryOperations { @Override @Deprecated public final org.jooq.SchemaMapping getSchemaMapping() { - return schemaMapping; + return null; } @Override @@ -526,7 +514,6 @@ public final class FactoryProxy implements FactoryOperations { return getDelegate().executeDeleteOne(table, condition); } - @SuppressWarnings("deprecation") private Factory getDelegate() { if (dataSource == null || dialect == null) { throw new DataAccessException("Both dataSource and dialect properties should be set"); @@ -536,17 +523,15 @@ public final class FactoryProxy implements FactoryOperations { Connection con = getDataSource().getConnection(); Constructor constructor; - if (schemaMapping == null) { + 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); } - else { - constructor = clazz.getConstructor(Connection.class, org.jooq.SchemaMapping.class); - return constructor.newInstance(con, schemaMapping); - } - } - catch (Exception e) { - throw new DataAccessException("Failed to create jOOQ Factory", e); + } catch (Exception exc) { + throw new DataAccessException("Failed to create jOOQ Factory", exc); } } }