diff --git a/jOOQ/src/main/java/org/jooq/Configuration.java b/jOOQ/src/main/java/org/jooq/Configuration.java
index 5c7594205b..ec11678e77 100644
--- a/jOOQ/src/main/java/org/jooq/Configuration.java
+++ b/jOOQ/src/main/java/org/jooq/Configuration.java
@@ -254,6 +254,11 @@ public interface Configuration extends Serializable {
*/
ConnectionProvider connectionProvider();
+ /**
+ * Get this configuration's underlying meta provider.
+ */
+ MetaProvider metaProvider();
+
/**
* Get this configuration's underlying executor provider.
*
@@ -431,6 +436,18 @@ public interface Configuration extends Serializable {
*/
Configuration set(ConnectionProvider newConnectionProvider);
+ /**
+ * Change this configuration to hold a new meta provider.
+ *
+ * This method is not thread-safe and should not be used in globally
+ * available Configuration objects.
+ *
+ * @param newMetaProvider The new meta provider to be contained in the
+ * changed configuration.
+ * @return The changed configuration.
+ */
+ Configuration set(MetaProvider newMetaProvider);
+
/**
* Change this configuration to hold a new executor provider.
*
@@ -776,6 +793,15 @@ public interface Configuration extends Serializable {
*/
Configuration derive(ConnectionProvider newConnectionProvider);
+ /**
+ * Create a derived configuration from this one, with a new meta provider.
+ *
+ * @param newMetaProvider The new meta provider to be contained in the
+ * derived configuration.
+ * @return The derived configuration.
+ */
+ Configuration derive(MetaProvider newMetaProvider);
+
/**
* Create a derived configuration from this one, with a new executor.
*
diff --git a/jOOQ/src/main/java/org/jooq/DSLContext.java b/jOOQ/src/main/java/org/jooq/DSLContext.java
index 21b77c4d59..1508ad0f6a 100644
--- a/jOOQ/src/main/java/org/jooq/DSLContext.java
+++ b/jOOQ/src/main/java/org/jooq/DSLContext.java
@@ -65,6 +65,7 @@ import static org.jooq.SQLDialect.SQLITE;
import java.math.BigInteger;
import java.sql.Connection;
+import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -250,7 +251,27 @@ public interface DSLContext extends Scope , AutoCloseable {
Meta meta();
/**
- * Access the databse meta data from its serialised form.
+ * Access the database meta data from JDBC {@link DatabaseMetaData}.
+ */
+ Meta meta(DatabaseMetaData meta);
+
+ /**
+ * Access the database meta data from catalog information.
+ */
+ Meta meta(Catalog... catalogs);
+
+ /**
+ * Access the database meta data from schema information.
+ */
+ Meta meta(Schema... schemas);
+
+ /**
+ * Access the database meta data from table information.
+ */
+ Meta meta(Table>... tables);
+
+ /**
+ * Access the database meta data from an JAXB-annotated meta model.
*/
Meta meta(InformationSchema schema);
diff --git a/jOOQ/src/main/java/org/jooq/MetaProvider.java b/jOOQ/src/main/java/org/jooq/MetaProvider.java
new file mode 100644
index 0000000000..c08b81b70a
--- /dev/null
+++ b/jOOQ/src/main/java/org/jooq/MetaProvider.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Other licenses:
+ * -----------------------------------------------------------------------------
+ * Commercial licenses for this work are available. These replace the above
+ * ASL 2.0 and offer limited warranties, support, maintenance, and commercial
+ * database integrations.
+ *
+ * For more information, please visit: http://www.jooq.org/licenses
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+package org.jooq;
+
+import java.sql.DatabaseMetaData;
+
+/**
+ * An SPI that can produce dynamic catalog, schema, table meta data information.
+ *
+ * The default implementation will produce information based on
+ * {@link DatabaseMetaData} obtained from the enclosing
+ * {@link Configuration#connectionProvider()}.
+ *
+ * @author Lukas Eder
+ */
+
+@FunctionalInterface
+
+public interface MetaProvider {
+
+ /**
+ * Provide meta data information.
+ */
+ Meta provide();
+}
diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultConfiguration.java b/jOOQ/src/main/java/org/jooq/impl/DefaultConfiguration.java
index e85288a36b..b31581b131 100644
--- a/jOOQ/src/main/java/org/jooq/impl/DefaultConfiguration.java
+++ b/jOOQ/src/main/java/org/jooq/impl/DefaultConfiguration.java
@@ -64,6 +64,7 @@ import org.jooq.DiagnosticsListenerProvider;
import org.jooq.ExecuteListener;
import org.jooq.ExecuteListenerProvider;
import org.jooq.ExecutorProvider;
+import org.jooq.MetaProvider;
import org.jooq.Record;
import org.jooq.RecordListener;
import org.jooq.RecordListenerProvider;
@@ -109,6 +110,7 @@ public class DefaultConfiguration implements Configuration {
// These objects may be user defined and thus not necessarily serialisable
private transient ConnectionProvider connectionProvider;
+ private transient MetaProvider metaProvider;
private transient ExecutorProvider executorProvider;
private transient TransactionProvider transactionProvider;
private transient RecordMapperProvider recordMapperProvider;
@@ -457,6 +459,7 @@ public class DefaultConfiguration implements Configuration {
{
this(
connectionProvider,
+ null,
executorProvider,
transactionProvider,
recordMapperProvider,
@@ -511,6 +514,7 @@ public class DefaultConfiguration implements Configuration {
{
this(
connectionProvider,
+ null,
executorProvider,
transactionProvider,
recordMapperProvider,
@@ -540,6 +544,7 @@ public class DefaultConfiguration implements Configuration {
*/
DefaultConfiguration(
ConnectionProvider connectionProvider,
+ MetaProvider metaProvider,
ExecutorProvider executorProvider,
TransactionProvider transactionProvider,
RecordMapperProvider recordMapperProvider,
@@ -558,6 +563,7 @@ public class DefaultConfiguration implements Configuration {
Map