- All Superinterfaces:
Scope
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:
- To increase API convenience, as no checked
SQLExceptionis thrown, only the uncheckedDataAccessException - To increase API convenience, as the returned objects are always jOOQ
objects, not JDBC
ResultSetobjects with hard-to-remember API constraints
This type is a Scope with independent lifecycle and its own
Scope.data() map.
- Author:
- Lukas Eder
-
Method Summary
Modifier and TypeMethodDescription@NotNull MetaApply a migration to this meta to produce a newMeta.@NotNull Metaapply(Collection<? extends Query> migration) Apply a migration to this meta to produce a newMeta.@NotNull MetaApply a migration to this meta to produce a newMeta.@NotNull MetaApply a migration to this meta to produce a newMeta.@NotNull Queriesddl()Generate a creation script for the entire meta data.@NotNull Queriesddl(DDLExportConfiguration configuration) Generate a creation script for the entire meta data.@NotNull MetafilterCatalogs(Predicate<? super Catalog> filter) Create a wrapperMetainstance filtering out some catalogs.@NotNull MetafilterDomains(Predicate<? super Domain<?>> filter) Create a wrapperMetainstance filtering out some domains.@NotNull MetafilterForeignKeys(Predicate<? super ForeignKey<?, ?>> filter) Create a wrapperMetainstance filtering out some foreign keys.@NotNull MetafilterIndexes(Predicate<? super Index> filter) Create a wrapperMetainstance filtering out some indexes.@NotNull MetafilterPrimaryKeys(Predicate<? super UniqueKey<?>> filter) Create a wrapperMetainstance filtering out some primary keys.@NotNull MetafilterSchemas(Predicate<? super Schema> filter) Create a wrapperMetainstance filtering out some schemas.@NotNull MetafilterSequences(Predicate<? super Sequence<?>> filter) Create a wrapperMetainstance filtering out some sequences.@NotNull MetafilterTables(Predicate<? super Table<?>> filter) Create a wrapperMetainstance filtering out some tables.@NotNull MetafilterUniqueKeys(Predicate<? super UniqueKey<?>> filter) Create a wrapperMetainstance filtering out some unique keys.@NotNull CataloggetCatalog(String name) Get a catalog object by name from the underlying meta data source, ornullif no such object exists.@NotNull CataloggetCatalog(Name name) Get a catalog object by name from the underlying meta data source, ornullif no such object exists.Get all catalog objects from the underlying meta data source.Get all domain objects from the underlying meta data source.getDomains(String name) Get all domain objects by name from the underlying meta data source.getDomains(Name name) Get all domain objects by name from the underlying meta data source.@NotNull List<ForeignKey<?,?>> Get all foreign keys from the underlying meta data source.@NotNull List<ForeignKey<?,?>> getForeignKeys(String name) Get all foreign keys from the underlying meta data source.@NotNull List<ForeignKey<?,?>> getForeignKeys(Name name) Get all foreign keys from the underlying meta data source.Get all indexes from the underlying meta data sources.getIndexes(String name) Get all indexes from the underlying meta data sources.getIndexes(Name name) Get all indexes from the underlying meta data sources.Get all primary keys from the underlying meta data source.getPrimaryKeys(String name) Get all primary keys from the underlying meta data source.getPrimaryKeys(Name name) Get all primary keys from the underlying meta data source.Get all schema objects from the underlying meta data source.getSchemas(String name) Get all schema objects by name from the underlying meta data source.getSchemas(Name name) Get all schema objects by name from the underlying meta data source.Get all sequence objects from the underlying meta data source.getSequences(String name) Get all sequence objects by name from the underlying meta data source.getSequences(Name name) Get all sequence objects by name from the underlying meta data source.Get all table objects from the underlying meta data source.Get all table objects by name from the underlying meta data source.Get all table objects by name from the underlying meta data source.Get all unique keys from the underlying meta data source.getUniqueKeys(String name) Get all unique keys from the underlying meta data source.getUniqueKeys(Name name) Get all unique keys from the underlying meta data source.@NotNull InformationSchemaExport to theInformationSchemaformat.@NotNull QueriesGenerate a migration script to get from this meta data to another one.@NotNull QueriesmigrateTo(Meta other, MigrationConfiguration configuration) Generate a migration script to get from this meta data to another one.@NotNull Metasnapshot()Eager-create an in-memory copy of thisMetainstance without any connection to the original data source.Methods inherited from interface org.jooq.Scope
configuration, creationTime, data, data, data, dialect, dsl, family, settings
-
Method Details
-
getCatalogs
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.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getCatalog
Get a catalog object by name from the underlying meta data source, ornullif no such object exists.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getCatalog
Get a catalog object by name from the underlying meta data source, ornullif no such object exists.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getSchemas
Get all schema objects from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getSchemas
Get all schema objects by name from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getSchemas
Get all schema objects by name from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getTables
Get all table objects from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getTables
Get all table objects by name from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getTables
Get all table objects by name from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getDomains
@NotNull @Support({AURORA_POSTGRES,H2,POSTGRES,SQLSERVER}) @NotNull List<Domain<?>> getDomains() throws DataAccessExceptionGet all domain objects from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getDomains
@NotNull @Support({AURORA_POSTGRES,H2,POSTGRES,SQLSERVER}) @NotNull List<Domain<?>> getDomains(String name) throws DataAccessException Get all domain objects by name from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getDomains
@NotNull @Support({AURORA_POSTGRES,H2,POSTGRES,SQLSERVER}) @NotNull List<Domain<?>> getDomains(Name name) throws DataAccessException Get all domain objects by name from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getSequences
@NotNull @Support({AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,ORACLE,POSTGRES,SNOWFLAKE,SQLSERVER2012,SYBASE}) @NotNull List<Sequence<?>> getSequences() throws DataAccessExceptionGet all sequence objects from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getSequences
@NotNull @Support({AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,ORACLE,POSTGRES,SNOWFLAKE,SQLSERVER2012,SYBASE}) @NotNull List<Sequence<?>> getSequences(String name) throws DataAccessException Get all sequence objects by name from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getSequences
@NotNull @Support({AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,ORACLE,POSTGRES,SNOWFLAKE,SQLSERVER2012,SYBASE}) @NotNull List<Sequence<?>> getSequences(Name name) throws DataAccessException Get all sequence objects by name from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getPrimaryKeys
Get all primary keys from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getPrimaryKeys
@NotNull @Support @NotNull List<UniqueKey<?>> getPrimaryKeys(String name) throws DataAccessException Get all primary keys from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getPrimaryKeys
Get all primary keys from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getUniqueKeys
Get all unique keys from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getUniqueKeys
Get all unique keys from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getUniqueKeys
Get all unique keys from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getForeignKeys
Get all foreign keys from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getForeignKeys
@NotNull @Support @NotNull List<ForeignKey<?,?>> getForeignKeys(String name) throws DataAccessException Get all foreign keys from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getForeignKeys
@NotNull @Support @NotNull List<ForeignKey<?,?>> getForeignKeys(Name name) throws DataAccessException Get all foreign keys from the underlying meta data source.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getIndexes
Get all indexes from the underlying meta data sources.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getIndexes
Get all indexes from the underlying meta data sources.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
getIndexes
Get all indexes from the underlying meta data sources.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
filterCatalogs
Create a wrapperMetainstance filtering out some catalogs. -
filterSchemas
Create a wrapperMetainstance filtering out some schemas. -
filterTables
Create a wrapperMetainstance filtering out some tables. -
filterDomains
Create a wrapperMetainstance filtering out some domains. -
filterSequences
Create a wrapperMetainstance filtering out some sequences. -
filterPrimaryKeys
Create a wrapperMetainstance filtering out some primary keys. -
filterUniqueKeys
Create a wrapperMetainstance filtering out some unique keys. -
filterForeignKeys
Create a wrapperMetainstance filtering out some foreign keys. -
filterIndexes
Create a wrapperMetainstance filtering out some indexes. -
snapshot
Eager-create an in-memory copy of thisMetainstance without any connection to the original data source.- Throws:
DataAccessException
-
ddl
Generate a creation script for the entire meta data.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
ddl
Generate a creation script for the entire meta data.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
apply
Apply a migration to this meta to produce a newMeta.- Throws:
DataAccessException- If something went wrong fetching the meta objects- See Also:
-
apply
Apply a migration to this meta to produce a newMeta.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
apply
Apply a migration to this meta to produce a newMeta.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
apply
Apply a migration to this meta to produce a newMeta.- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
migrateTo
Generate a migration script to get from this meta data to another one.See
migrateTo(Meta, MigrationConfiguration)for more details.- Throws:
DataAccessException- If something went wrong fetching the meta objects- See Also:
-
migrateTo
@NotNull @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.
- Throws:
DataAccessException- If something went wrong fetching the meta objects
-
informationSchema
Export to theInformationSchemaformat.This allows for serialising schema meta information as XML using JAXB. See also
Constants.XSD_METAfor details.- Throws:
DataAccessException
-