- 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
SQLException
is thrown, only the uncheckedDataAccessException
- 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
Scope.data()
map.
- Author:
- Lukas Eder
-
Method Summary
Modifier and TypeMethodDescription@NotNull Meta
Apply a migration to this meta to produce a newMeta
.@NotNull Meta
apply
(Collection<? extends Query> migration) Apply a migration to this meta to produce a newMeta
.@NotNull Meta
Apply a migration to this meta to produce a newMeta
.@NotNull Meta
Apply a migration to this meta to produce a newMeta
.@NotNull Queries
ddl()
Generate a creation script for the entire meta data.@NotNull Queries
ddl
(DDLExportConfiguration configuration) Generate a creation script for the entire meta data.@NotNull Meta
filterCatalogs
(Predicate<? super Catalog> filter) Create a wrapperMeta
instance filtering out some catalogs.@NotNull Meta
filterDomains
(Predicate<? super Domain<?>> filter) Create a wrapperMeta
instance filtering out some domains.@NotNull Meta
filterForeignKeys
(Predicate<? super ForeignKey<?, ?>> filter) Create a wrapperMeta
instance filtering out some foreign keys.@NotNull Meta
filterIndexes
(Predicate<? super Index> filter) Create a wrapperMeta
instance filtering out some indexes.@NotNull Meta
filterPrimaryKeys
(Predicate<? super UniqueKey<?>> filter) Create a wrapperMeta
instance filtering out some primary keys.@NotNull Meta
filterSchemas
(Predicate<? super Schema> filter) Create a wrapperMeta
instance filtering out some schemas.@NotNull Meta
filterSequences
(Predicate<? super Sequence<?>> filter) Create a wrapperMeta
instance filtering out some sequences.@NotNull Meta
filterSynonyms
(Predicate<? super Synonym> filter) Create a wrapperMeta
instance filtering out some synonym.@NotNull Meta
filterTables
(Predicate<? super Table<?>> filter) Create a wrapperMeta
instance filtering out some tables.@NotNull Meta
filterTriggers
(Predicate<? super Trigger> filter) Create a wrapperMeta
instance filtering out some triggers.@NotNull Meta
filterUniqueKeys
(Predicate<? super UniqueKey<?>> filter) Create a wrapperMeta
instance filtering out some unique keys.@NotNull Catalog
getCatalog
(String name) Get a catalog object by name from the underlying meta data source, ornull
if no such object exists.@NotNull Catalog
getCatalog
(Name name) Get a catalog object by name from the underlying meta data source, ornull
if 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 public synonym objects from the underlying meta data source.getPublicSynonyms
(String name) Get all public synonym objects by name from the underlying meta data source.getPublicSynonyms
(Name name) Get all public synonym objects by name 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 synonym objects from the underlying meta data source.getSynonyms
(String name) Get all synonym objects by name from the underlying meta data source.getSynonyms
(Name name) Get all synonym 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 trigger objects from the underlying meta data source.getTriggers
(String name) Get all trigger objects by name from the underlying meta data source.getTriggers
(Name name) Get all trigger 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 InformationSchema
Export to theInformationSchema
format.@NotNull Queries
Generate a migration script to get from this meta data to another one.@NotNull Queries
migrateTo
(Meta other, MigrationConfiguration configuration) Generate a migration script to get from this meta data to another one.@NotNull Meta
snapshot()
Eager-create an in-memory copy of thisMeta
instance 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, ornull
if 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, ornull
if 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
-
getTriggers
@NotNull @Support({AURORA_POSTGRES,DB2,DERBY,FIREBIRD_3_0,HSQLDB,INFORMIX,MARIADB,MYSQL,ORACLE,POSTGRES,SQLITE,SQLSERVER,YUGABYTEDB}) @Pro @NotNull List<Trigger> getTriggers() throws DataAccessExceptionGet all trigger objects from the underlying meta data source.- Throws:
DataAccessException
- If something went wrong fetching the meta objects
-
getTriggers
@NotNull @Support({AURORA_POSTGRES,DB2,DERBY,FIREBIRD_3_0,HSQLDB,INFORMIX,MARIADB,MYSQL,ORACLE,POSTGRES,SQLITE,SQLSERVER,YUGABYTEDB}) @Pro @NotNull List<Trigger> getTriggers(String name) throws DataAccessException Get all trigger objects by name from the underlying meta data source.- Throws:
DataAccessException
- If something went wrong fetching the meta objects
-
getTriggers
@NotNull @Support({AURORA_POSTGRES,DB2,DERBY,FIREBIRD_3_0,HSQLDB,INFORMIX,MARIADB,MYSQL,ORACLE,POSTGRES,SQLITE,SQLSERVER,YUGABYTEDB}) @Pro @NotNull List<Trigger> getTriggers(Name name) throws DataAccessException Get all trigger objects by name from the underlying meta data source.- Throws:
DataAccessException
- If something went wrong fetching the meta objects
-
getSynonyms
@NotNull @Support({DB2,DERBY,H2,HANA,HSQLDB,INFORMIX,ORACLE,SQLSERVER}) @Pro @NotNull List<Synonym> getSynonyms() throws DataAccessExceptionGet all synonym objects from the underlying meta data source.- Throws:
DataAccessException
- If something went wrong fetching the meta objects
-
getSynonyms
@NotNull @Support({DB2,DERBY,H2,HANA,HSQLDB,INFORMIX,ORACLE,SQLSERVER}) @Pro @NotNull List<Synonym> getSynonyms(String name) throws DataAccessException Get all synonym objects by name from the underlying meta data source.- Throws:
DataAccessException
- If something went wrong fetching the meta objects
-
getSynonyms
@NotNull @Support({DB2,DERBY,H2,HANA,HSQLDB,INFORMIX,ORACLE,SQLSERVER}) @Pro @NotNull List<Synonym> getSynonyms(Name name) throws DataAccessException Get all synonym objects by name from the underlying meta data source.- Throws:
DataAccessException
- If something went wrong fetching the meta objects
-
getPublicSynonyms
@NotNull @Support({DB2,DERBY,H2,HANA,HSQLDB,INFORMIX,ORACLE,SQLSERVER}) @Pro @NotNull List<Synonym> getPublicSynonyms() throws DataAccessExceptionGet all public synonym objects from the underlying meta data source.- Throws:
DataAccessException
- If something went wrong fetching the meta objects
-
getPublicSynonyms
@NotNull @Support({DB2,DERBY,H2,HANA,HSQLDB,INFORMIX,ORACLE,SQLSERVER}) @Pro @NotNull List<Synonym> getPublicSynonyms(String name) throws DataAccessException Get all public synonym objects by name from the underlying meta data source.- Throws:
DataAccessException
- If something went wrong fetching the meta objects
-
getPublicSynonyms
@NotNull @Support({DB2,DERBY,H2,HANA,HSQLDB,INFORMIX,ORACLE,SQLSERVER}) @Pro @NotNull List<Synonym> getPublicSynonyms(Name name) throws DataAccessException Get all public synonym 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 wrapperMeta
instance filtering out some catalogs. -
filterSchemas
Create a wrapperMeta
instance filtering out some schemas. -
filterTables
Create a wrapperMeta
instance filtering out some tables. -
filterDomains
Create a wrapperMeta
instance filtering out some domains. -
filterTriggers
Create a wrapperMeta
instance filtering out some triggers. -
filterSynonyms
Create a wrapperMeta
instance filtering out some synonym. -
filterSequences
Create a wrapperMeta
instance filtering out some sequences. -
filterPrimaryKeys
Create a wrapperMeta
instance filtering out some primary keys. -
filterUniqueKeys
Create a wrapperMeta
instance filtering out some unique keys. -
filterForeignKeys
Create a wrapperMeta
instance filtering out some foreign keys. -
filterIndexes
Create a wrapperMeta
instance filtering out some indexes. -
snapshot
Eager-create an in-memory copy of thisMeta
instance 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 theInformationSchema
format.This allows for serialising schema meta information as XML using JAXB. See also
Constants.XSD_META
for details.- Throws:
DataAccessException
-