Top Description Methods
org.jooq

public Interface Meta

extends Scope
Known Direct Implementers
org.jooq.impl.AbstractMeta
Static Imports
org.jooq.SQLDialect.CUBRID, .SQLDialect.DERBY, .SQLDialect.FIREBIRD, .SQLDialect.H2, .SQLDialect.HSQLDB, .SQLDialect.POSTGRES

A wrapping object for DatabaseMetaData or for other sources of database meta information (e.g. InformationSchema)

This object can be obtained through DSLContext#meta() in order to provide convenient access to your database meta data. This abstraction has two purposes:

  1. To increase API convenience, as no checked SQLException is thrown, only the unchecked DataAccessException
  2. To increase API convenience, as the returned objects are always jOOQ objects, not JDBC ResultSet objects with hard-to-remember API constraints

This type is a Scope with independent lifecycle and its own data() map.

Author
Lukas Eder

Method Summary

Modifier and TypeMethod and Description
public @NotNull Meta
apply(String migration)

Apply a migration to this meta to produce a new Meta.

public @NotNull Meta
apply(Query... migration)

Apply a migration to this meta to produce a new Meta.

public @NotNull Meta
apply(Collection<? extends Query> migration)

Apply a migration to this meta to produce a new Meta.

public @NotNull Meta
apply(Queries migration)

Apply a migration to this meta to produce a new Meta.

public @NotNull Queries
ddl()

Generate a creation script for the entire meta data.

public @NotNull Queries
ddl(DDLExportConfiguration configuration)

Generate a creation script for the entire meta data.

public @NotNull Meta
filterCatalogs(Predicate<? super Catalog> filter)

Create a wrapper Meta instance filtering out some catalogs.

public @NotNull Meta
filterDomains(Predicate<? super Domain<?>> filter)

Create a wrapper Meta instance filtering out some domains.

public @NotNull Meta
filterForeignKeys(Predicate<? super ForeignKey<?, ?>> filter)

Create a wrapper Meta instance filtering out some foreign keys.

public @NotNull Meta
filterIndexes(Predicate<? super Index> filter)

Create a wrapper Meta instance filtering out some indexes.

public @NotNull Meta
filterPrimaryKeys(Predicate<? super UniqueKey<?>> filter)

Create a wrapper Meta instance filtering out some primary keys.

public @NotNull Meta
filterSchemas(Predicate<? super Schema> filter)

Create a wrapper Meta instance filtering out some schemas.

public @NotNull Meta
filterSequences(Predicate<? super Sequence<?>> filter)

Create a wrapper Meta instance filtering out some sequences.

public @NotNull Meta
filterTables(Predicate<? super Table<?>> filter)

Create a wrapper Meta instance filtering out some tables.

public @NotNull Meta
filterUniqueKeys(Predicate<? super UniqueKey<?>> filter)

Create a wrapper Meta instance filtering out some unique keys.

public @NotNull Catalog
getCatalog(String name)

Get a catalog object by name from the underlying meta data source, or null if no such object exists.

public @NotNull Catalog
getCatalog(Name name)

Get a catalog object by name from the underlying meta data source, or null if no such object exists.

public @NotNull List<Catalog>
getCatalogs()

Get all catalog objects from the underlying meta data source.

public @NotNull List<Domain<?>>
getDomains()

Get all domain objects from the underlying meta data source.

public @NotNull List<Domain<?>>
getDomains(String name)

Get all domain objects by name from the underlying meta data source.

public @NotNull List<Domain<?>>
getDomains(Name name)

Get all domain objects by name from the underlying meta data source.

public @NotNull List<ForeignKey<?, ?>>
getForeignKeys()

Get all foreign keys from the underlying meta data source.

public @NotNull List<ForeignKey<?, ?>>
getForeignKeys(String name)

Get all foreign keys from the underlying meta data source.

public @NotNull List<ForeignKey<?, ?>>
getForeignKeys(Name name)

Get all foreign keys from the underlying meta data source.

public @NotNull List<Index>
getIndexes()

Get all indexes from the underlying meta data sources.

public @NotNull List<Index>
getIndexes(String name)

Get all indexes from the underlying meta data sources.

public @NotNull List<Index>
getIndexes(Name name)

Get all indexes from the underlying meta data sources.

public @NotNull List<UniqueKey<?>>
getPrimaryKeys()

Get all primary keys from the underlying meta data source.

public @NotNull List<UniqueKey<?>>
getPrimaryKeys(String name)

Get all primary keys from the underlying meta data source.

public @NotNull List<UniqueKey<?>>
getPrimaryKeys(Name name)

Get all primary keys from the underlying meta data source.

public @NotNull List<Schema>
getSchemas()

Get all schema objects from the underlying meta data source.

public @NotNull List<Schema>
getSchemas(String name)

Get all schema objects by name from the underlying meta data source.

public @NotNull List<Schema>
getSchemas(Name name)

Get all schema objects by name from the underlying meta data source.

public @NotNull List<Sequence<?>>
getSequences()

Get all sequence objects from the underlying meta data source.

public @NotNull List<Sequence<?>>
getSequences(String name)

Get all sequence objects by name from the underlying meta data source.

public @NotNull List<Sequence<?>>
getSequences(Name name)

Get all sequence objects by name from the underlying meta data source.

public @NotNull List<Table<?>>
getTables()

Get all table objects from the underlying meta data source.

public @NotNull List<Table<?>>
getTables(String name)

Get all table objects by name from the underlying meta data source.

public @NotNull List<Table<?>>
getTables(Name name)

Get all table objects by name from the underlying meta data source.

public @NotNull List<UniqueKey<?>>
getUniqueKeys()

Get all unique keys from the underlying meta data source.

public @NotNull List<UniqueKey<?>>
getUniqueKeys(String name)

Get all unique keys from the underlying meta data source.

public @NotNull List<UniqueKey<?>>
getUniqueKeys(Name name)

Get all unique keys from the underlying meta data source.

public @NotNull InformationSchema
informationSchema()

Export to the InformationSchema format.

public @NotNull Queries
migrateTo(Meta other)

Generate a migration script to get from this meta data to another one.

public @NotNull Queries
migrateTo(Meta other, MigrationConfiguration configuration)

Generate a migration script to get from this meta data to another one.

public @NotNull Meta
snapshot()

Eager-create an in-memory copy of this Meta instance without any connection to the original data source.

Inherited from org.jooq.Scope:
configurationcreationTimedatadatadatadialectdslfamilysettings

Method Detail

applyback to summary
public @NotNull Meta apply(String migration) throws DataAccessException

Apply a migration to this meta to produce a new Meta.

Annotations
@NotNull
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
See Also
Parser#parse(String)
applyback to summary
public @NotNull Meta apply(Query... migration) throws DataAccessException

Apply a migration to this meta to produce a new Meta.

Annotations
@NotNull
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
applyback to summary
public @NotNull Meta apply(Collection<? extends Query> migration) throws DataAccessException

Apply a migration to this meta to produce a new Meta.

Annotations
@NotNull
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
applyback to summary
public @NotNull Meta apply(Queries migration) throws DataAccessException

Apply a migration to this meta to produce a new Meta.

Annotations
@NotNull
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
ddlback to summary
public @NotNull Queries ddl() throws DataAccessException

Generate a creation script for the entire meta data.

Annotations
@NotNull
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
ddlback to summary
public @NotNull Queries ddl(DDLExportConfiguration configuration) throws DataAccessException

Generate a creation script for the entire meta data.

Annotations
@NotNull
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
filterCatalogsback to summary
public @NotNull Meta filterCatalogs(Predicate<? super Catalog> filter)

Create a wrapper Meta instance filtering out some catalogs.

Annotations
@NotNull
filterDomainsback to summary
public @NotNull Meta filterDomains(Predicate<? super Domain<?>> filter)

Create a wrapper Meta instance filtering out some domains.

Annotations
@NotNull
filterForeignKeysback to summary
public @NotNull Meta filterForeignKeys(Predicate<? super ForeignKey<?, ?>> filter)

Create a wrapper Meta instance filtering out some foreign keys.

Annotations
@NotNull
filterIndexesback to summary
public @NotNull Meta filterIndexes(Predicate<? super Index> filter)

Create a wrapper Meta instance filtering out some indexes.

Annotations
@NotNull
filterPrimaryKeysback to summary
public @NotNull Meta filterPrimaryKeys(Predicate<? super UniqueKey<?>> filter)

Create a wrapper Meta instance filtering out some primary keys.

Annotations
@NotNull
filterSchemasback to summary
public @NotNull Meta filterSchemas(Predicate<? super Schema> filter)

Create a wrapper Meta instance filtering out some schemas.

Annotations
@NotNull
filterSequencesback to summary
public @NotNull Meta filterSequences(Predicate<? super Sequence<?>> filter)

Create a wrapper Meta instance filtering out some sequences.

Annotations
@NotNull
filterTablesback to summary
public @NotNull Meta filterTables(Predicate<? super Table<?>> filter)

Create a wrapper Meta instance filtering out some tables.

Annotations
@NotNull
filterUniqueKeysback to summary
public @NotNull Meta filterUniqueKeys(Predicate<? super UniqueKey<?>> filter)

Create a wrapper Meta instance filtering out some unique keys.

Annotations
@NotNull
getCatalogback to summary
public @NotNull Catalog getCatalog(String name) throws DataAccessException

Get a catalog object by name from the underlying meta data source, or null if no such object exists.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getCatalogback to summary
public @NotNull Catalog getCatalog(Name name) throws DataAccessException

Get a catalog object by name from the underlying meta data source, or null if no such object exists.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getCatalogsback to summary
public @NotNull List<Catalog> getCatalogs() throws DataAccessException

Get all catalog objects from the underlying meta data source.

For those databases that don't really support JDBC meta data catalogs, a single empty catalog (named "") will be returned. In other words, there is always at least one catalog in a database.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getDomainsback to summary
public @NotNull List<Domain<?>> getDomains() throws DataAccessException

Get all domain objects from the underlying meta data source.

Annotations
@NotNull
@Support:H2, POSTGRES
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getDomainsback to summary
public @NotNull List<Domain<?>> getDomains(String name) throws DataAccessException

Get all domain objects by name from the underlying meta data source.

Annotations
@NotNull
@Support:H2, POSTGRES
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getDomainsback to summary
public @NotNull List<Domain<?>> getDomains(Name name) throws DataAccessException

Get all domain objects by name from the underlying meta data source.

Annotations
@NotNull
@Support:H2, POSTGRES
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getForeignKeysback to summary
public @NotNull List<ForeignKey<?, ?>> getForeignKeys() throws DataAccessException

Get all foreign keys from the underlying meta data source.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getForeignKeysback to summary
public @NotNull List<ForeignKey<?, ?>> getForeignKeys(String name) throws DataAccessException

Get all foreign keys from the underlying meta data source.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getForeignKeysback to summary
public @NotNull List<ForeignKey<?, ?>> getForeignKeys(Name name) throws DataAccessException

Get all foreign keys from the underlying meta data source.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getIndexesback to summary
public @NotNull List<Index> getIndexes() throws DataAccessException

Get all indexes from the underlying meta data sources.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getIndexesback to summary
public @NotNull List<Index> getIndexes(String name) throws DataAccessException

Get all indexes from the underlying meta data sources.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getIndexesback to summary
public @NotNull List<Index> getIndexes(Name name) throws DataAccessException

Get all indexes from the underlying meta data sources.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getPrimaryKeysback to summary
public @NotNull List<UniqueKey<?>> getPrimaryKeys() throws DataAccessException

Get all primary keys from the underlying meta data source.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getPrimaryKeysback to summary
public @NotNull List<UniqueKey<?>> getPrimaryKeys(String name) throws DataAccessException

Get all primary keys from the underlying meta data source.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getPrimaryKeysback to summary
public @NotNull List<UniqueKey<?>> getPrimaryKeys(Name name) throws DataAccessException

Get all primary keys from the underlying meta data source.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getSchemasback to summary
public @NotNull List<Schema> getSchemas() throws DataAccessException

Get all schema objects from the underlying meta data source.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getSchemasback to summary
public @NotNull List<Schema> getSchemas(String name) throws DataAccessException

Get all schema objects by name from the underlying meta data source.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getSchemasback to summary
public @NotNull List<Schema> getSchemas(Name name) throws DataAccessException

Get all schema objects by name from the underlying meta data source.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getSequencesback to summary
public @NotNull List<Sequence<?>> getSequences() throws DataAccessException

Get all sequence objects from the underlying meta data source.

Annotations
@NotNull
@Support:CUBRID, DERBY, FIREBIRD, H2, HSQLDB, POSTGRES
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getSequencesback to summary
public @NotNull List<Sequence<?>> getSequences(String name) throws DataAccessException

Get all sequence objects by name from the underlying meta data source.

Annotations
@NotNull
@Support:CUBRID, DERBY, FIREBIRD, H2, HSQLDB, POSTGRES
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getSequencesback to summary
public @NotNull List<Sequence<?>> getSequences(Name name) throws DataAccessException

Get all sequence objects by name from the underlying meta data source.

Annotations
@NotNull
@Support:CUBRID, DERBY, FIREBIRD, H2, HSQLDB, POSTGRES
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getTablesback to summary
public @NotNull List<Table<?>> getTables() throws DataAccessException

Get all table objects from the underlying meta data source.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getTablesback to summary
public @NotNull List<Table<?>> getTables(String name) throws DataAccessException

Get all table objects by name from the underlying meta data source.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getTablesback to summary
public @NotNull List<Table<?>> getTables(Name name) throws DataAccessException

Get all table objects by name from the underlying meta data source.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getUniqueKeysback to summary
public @NotNull List<UniqueKey<?>> getUniqueKeys() throws DataAccessException

Get all unique keys from the underlying meta data source.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getUniqueKeysback to summary
public @NotNull List<UniqueKey<?>> getUniqueKeys(String name) throws DataAccessException

Get all unique keys from the underlying meta data source.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
getUniqueKeysback to summary
public @NotNull List<UniqueKey<?>> getUniqueKeys(Name name) throws DataAccessException

Get all unique keys from the underlying meta data source.

Annotations
@NotNull
@Support
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
informationSchemaback to summary
public @NotNull InformationSchema informationSchema() throws DataAccessException

Export to the InformationSchema format.

This allows for serialising schema meta information as XML using JAXB. See also Constants#XSD_META for details.

Annotations
@NotNull
migrateToback to summary
public @NotNull Queries migrateTo(Meta other) throws DataAccessException

Generate a migration script to get from this meta data to another one.

See migrateTo(Meta, MigrationConfiguration) for more details.

Annotations
@NotNull
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
See Also
migrateTo(Meta, MigrationConfiguration)
migrateToback to summary
public @NotNull Queries migrateTo(Meta other, MigrationConfiguration configuration) throws DataAccessException

Generate a migration script to get from this meta data to another one.

To some extent, some database migrations can be generated automatically by comparing two versions of a schema. This is what migrateTo() does. It supports:

  • Schema additions / removals
  • Table additions / removals
  • Column additions / removals
  • Column data type changes
  • Constraint additions / removals
  • Index additions / removals
  • Sequence additions / removals
  • Comment additions / removals

More complex, structural changes, such as moving some columns from one table to another, or turning a to-one relationship into a to-many relationship, as well as data migrations, can currently not be detected automatically.

Annotations
@NotNull
Exceptions
DataAccessException:
If something went wrong fetching the meta objects
snapshotback to summary
public @NotNull Meta snapshot() throws DataAccessException

Eager-create an in-memory copy of this Meta instance without any connection to the original data source.

Annotations
@NotNull