Class TableMetaData

java.lang.Object
org.tentackle.sql.metadata.TableMetaData

public class TableMetaData extends Object
Database metadata for a table that is part of the model.
Author:
harald
  • Constructor Details

    • TableMetaData

      public TableMetaData(ModelMetaData modelMetaData, String modelTableName)
      Creates a table meta instance.
      Parameters:
      modelMetaData - the model this table belongs to
      modelTableName - the tablename used in the model
  • Method Details

    • setupTableFromMetaData

      public void setupTableFromMetaData(DatabaseMetaData metaData, String[] schemas, String schemaPattern, String tablePattern) throws SQLException
      Sets up the column from the database metadata result.
      Parameters:
      metaData - the database metadata
      schemas - valid schemas to scan, null if all
      schemaPattern - the schema (null if none, "" if without schema)
      tablePattern - the table pattern
      Throws:
      SQLException - the processing failed
      BackendException - if logical meta data processing error
    • getModelMetaData

      public ModelMetaData getModelMetaData()
      Gets the model this table belongs to.
      Returns:
      the model
    • getModelTableName

      public String getModelTableName()
      Gets the table name used in the model.
      Returns:
      the model's tablename
    • getSchemaName

      public String getSchemaName()
      Gets the database schema name.
      Always in lowercase.
      Returns:
      the schema, null if none
    • getTableName

      public String getTableName()
      Gets the database table name.
      Always in lowercase.
      Returns:
      the table name (without schema)
    • getFullTableName

      public String getFullTableName()
      Gets the database table name with optional schemaname prepended.
      Always in lowercase.
      Returns:
      the full table name
    • getComment

      public String getComment()
      Gets the comment.
      Returns:
      the comment, null if none
    • setComment

      public void setComment(String comment)
      Sets the comment.
      Parameters:
      comment - the comment, null if none
    • getColumns

      public Collection<ColumnMetaData> getColumns()
      Gets the metadata for columns.
      Returns:
      the columns
    • getColumnByName

      public ColumnMetaData getColumnByName(String columnName)
      Gets a column by its column name.
      Parameters:
      columnName - the column name
      Returns:
      the column, null if no such column
    • getIndexes

      public Collection<IndexMetaData> getIndexes()
      Gets the metadata for indexes.
      Returns:
      the indexes
    • getForeignKeys

      public Collection<ForeignKeyMetaData> getForeignKeys()
      Gets the foreign keys.
      Returns:
      the foreign keys
    • validate

      public void validate()
      Validates and post-processes the table data.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object