diff --git a/jOOQ/src/main/java/org/jooq/DSLContext.java b/jOOQ/src/main/java/org/jooq/DSLContext.java index 85122aaae4..a376d6bd3e 100644 --- a/jOOQ/src/main/java/org/jooq/DSLContext.java +++ b/jOOQ/src/main/java/org/jooq/DSLContext.java @@ -312,56 +312,50 @@ public interface DSLContext extends Scope , AutoCloseable { Meta meta(Source... scripts); /** - * Export a catalog to the {@link InformationSchema} format. - *
- * This allows for serialising schema meta information as XML using JAXB. - * See also {@link Constants#XSD_META} for details. + * Convenience method for {@link Meta#informationSchema()}. + * + * @see #meta(Catalog...) + * @see Meta#informationSchema() */ InformationSchema informationSchema(Catalog catalog); /** - * Export a set of catalogs to the {@link InformationSchema} format. - *
- * This allows for serialising schema meta information as XML using JAXB. - * See also {@link Constants#XSD_META} for details. + * Convenience method for {@link Meta#informationSchema()}. + * + * @see #meta(Catalog...) + * @see Meta#informationSchema() */ InformationSchema informationSchema(Catalog... catalogs); /** - * Export a schema to the {@link InformationSchema} format. - *
- * This allows for serialising schema meta information as XML using JAXB. - * See also {@link Constants#XSD_META} for details. + * Convenience method for {@link Meta#informationSchema()}. + * + * @see #meta(Schema...) + * @see Meta#informationSchema() */ InformationSchema informationSchema(Schema schema); /** - * Export a set of schemas to the {@link InformationSchema} format. - *
- * This allows for serialising schema meta information as XML using JAXB. - * See also {@link Constants#XSD_META} for details. + * Convenience method for {@link Meta#informationSchema()}. + * + * @see #meta(Schema...) + * @see Meta#informationSchema() */ InformationSchema informationSchema(Schema... schemas); /** - * Export a table to the {@link InformationSchema} format. - *
- * Exporting a single table will not include any foreign key definitions in - * the exported data. - *
- * This allows for serialising schema meta information as XML using JAXB. - * See also {@link Constants#XSD_META} for details. + * Convenience method for {@link Meta#informationSchema()}. + * + * @see #meta(Table...) + * @see Meta#informationSchema() */ InformationSchema informationSchema(Table> table); /** - * Export a set of tables to the {@link InformationSchema} format. - *
- * Only those foreign keys whose referenced table is also included in the - * export will be exported. - *
- * This allows for serialising schema meta information as XML using JAXB. - * See also {@link Constants#XSD_META} for details. + * Convenience method for {@link Meta#informationSchema()}. + * + * @see #meta(Table...) + * @see Meta#informationSchema() */ InformationSchema informationSchema(Table>... table); diff --git a/jOOQ/src/main/java/org/jooq/Meta.java b/jOOQ/src/main/java/org/jooq/Meta.java index e3b8358841..a214b61fe1 100644 --- a/jOOQ/src/main/java/org/jooq/Meta.java +++ b/jOOQ/src/main/java/org/jooq/Meta.java @@ -218,4 +218,12 @@ public interface Meta extends Scope { * objects */ Queries ddl(DDLExportConfiguration configuration) throws DataAccessException; + + /** + * Export to the {@link InformationSchema} format. + *
+ * This allows for serialising schema meta information as XML using JAXB. + * See also {@link Constants#XSD_META} for details. + */ + InformationSchema informationSchema() throws DataAccessException; } diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractMeta.java b/jOOQ/src/main/java/org/jooq/impl/AbstractMeta.java index 25b99e53a6..7e03bf2af7 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractMeta.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractMeta.java @@ -59,6 +59,7 @@ import org.jooq.Sequence; import org.jooq.Table; import org.jooq.UniqueKey; import org.jooq.exception.DataAccessException; +import org.jooq.util.xml.jaxb.InformationSchema; /** * @author Lukas Eder @@ -294,4 +295,11 @@ abstract class AbstractMeta extends AbstractScope implements Meta, Serializable public /* non-final */ Queries ddl(DDLExportConfiguration exportConfiguration) throws DataAccessException { return new DDL(this, exportConfiguration).queries(); } + + // [#9396] TODO Fix this. Subclasses should not need to override this to get + // correct results + @Override + public /* non-final */ InformationSchema informationSchema() throws DataAccessException { + return InformationSchemaExport.exportCatalogs(configuration(), getCatalogs()); + } } diff --git a/jOOQ/src/main/java/org/jooq/impl/TableMetaImpl.java b/jOOQ/src/main/java/org/jooq/impl/TableMetaImpl.java index ee137c8731..2fa52b6a81 100644 --- a/jOOQ/src/main/java/org/jooq/impl/TableMetaImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/TableMetaImpl.java @@ -53,6 +53,7 @@ import org.jooq.Sequence; import org.jooq.Table; import org.jooq.UniqueKey; import org.jooq.exception.DataAccessException; +import org.jooq.util.xml.jaxb.InformationSchema; /** * @author Lukas Eder @@ -116,4 +117,9 @@ final class TableMetaImpl extends AbstractMeta { public Queries ddl(DDLExportConfiguration exportConfiguration) throws DataAccessException { return new DDL(this, exportConfiguration).queries(tables); } + + @Override + public InformationSchema informationSchema() throws DataAccessException { + return InformationSchemaExport.exportTables(configuration(), getTables()); + } }