Interface MetaData

All Known Implementing Classes:
MetaDataImpl

public interface MetaData
Access jdbc metadata associated to a connection's database. The data is fetched lazily and cached in memory. You may call clearCache() to invalidate all cache entries.
  • Method Details

    • useConnection

      MetaData useConnection(Connection conn)
      Use the given connection for all database accesses instead of obtaining new ones from the data source.
    • getTables

      Iterable<TableMetaData> getTables()
    • getForeignKeyInfo

      Iterable<MetaData.ForeignKeyInfo> getForeignKeyInfo(TableMetaData source, TableMetaData target)
      Returns all foreign key information from the source table that references primary or unique keys in the target table.

      Most often, this will contain one item or is empty, as there are usually not more than one reference from one table to another.

    • getForeignKeyInfo

      Iterable<MetaData.ForeignKeyInfo> getForeignKeyInfo(RelationModel model)
      Finds the foreign key information at the database for the given relation model.

      If this is a many-to-many relation, there are two foreign key infos returned, where the foreignkey is always the same link table and the primary key either the target or source table of the relation.

      If this is a many-to-one relation, there is only one foreign key info returned, where the foreign key is the one-side (source) of the relation and the primary key the many side (target).

    • forEntity

      Optional<TableMetaData> forEntity(EntityModel model)
      Finds a table corresponding to the given entity model.
    • forTable

      Optional<TableMetaData> forTable(String tableName)
      Finds a table with the given tablename.
    • forRelation

      Optional<TableMetaData> forRelation(RelationModel relationModel)
      Finds the link table for the given n:m relation model.
    • findColumns

      Iterable<ColumnMetaData> findColumns(RelationModel relationModel)
      Finds the foreign key columns for the given 1:n relation model.
    • getDataSourceName

      String getDataSourceName()
    • getDataSource

      DataSource getDataSource()
    • getSchemaName

      @Nullable @Nullable String getSchemaName()
    • isDefault

      boolean isDefault()
    • clearCache

      void clearCache()