Package org.hibernate.mapping
Class Table
- java.lang.Object
-
- org.hibernate.mapping.Table
-
- All Implemented Interfaces:
Serializable
,ContributableDatabaseObject
,Exportable
,Contributable
- Direct Known Subclasses:
DenormalizedTable
public class Table extends Object implements Serializable, ContributableDatabaseObject
A mapping model object representing a relational database table.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Table.ForeignKeyKey
-
Constructor Summary
Constructors Constructor Description Table()
Deprecated, for removal: This API element is subject to removal in a future version.Table(String contributor)
Table(String contributor, String name)
Table(String contributor, Namespace namespace, String subselect, boolean isAbstract)
Table(String contributor, Namespace namespace, Identifier physicalTableName, boolean isAbstract)
Table(String contributor, Namespace namespace, Identifier physicalTableName, String subselect, boolean isAbstract)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addCheck(CheckConstraint check)
void
addCheckConstraint(String constraint)
Deprecated.void
addColumn(Column column)
Index
addIndex(Index index)
void
addInitCommand(Function<SqlStringGenerationContext,InitCommand> commandProducer)
void
addInitCommand(InitCommand command)
Deprecated.UseaddInitCommand(Function)
instead.UniqueKey
addUniqueKey(UniqueKey uniqueKey)
void
columnRenamed(Column column)
boolean
containsColumn(Column column)
ForeignKey
createForeignKey(String keyName, List<Column> keyColumns, String referencedEntityName, String keyDefinition)
ForeignKey
createForeignKey(String keyName, List<Column> keyColumns, String referencedEntityName, String keyDefinition, List<Column> referencedColumns)
void
createForeignKeys(MetadataBuildingContext context)
void
createUniqueKey(List<Column> keyColumns)
Deprecated, for removal: This API element is subject to removal in a future version.void
createUniqueKey(List<Column> keyColumns, MetadataBuildingContext context)
If there is one given column, mark it unique, otherwise create aUniqueKey
comprising the given columns.void
createUniqueKey(Column column, MetadataBuildingContext context)
Mark the given column unique.boolean
equals(Object object)
boolean
equals(Table table)
String
getCatalog()
Identifier
getCatalogIdentifier()
List<String>
getCheckConstraints()
Deprecated, for removal: This API element is subject to removal in a future version.No longer used, should be removedIterator<String>
getCheckConstraintsIterator()
Deprecated, for removal: This API element is subject to removal in a future version.No longer used, should be removedList<CheckConstraint>
getChecks()
Column
getColumn(int n)
Column
getColumn(Identifier name)
Column
getColumn(InFlightMetadataCollector collector, String logicalName)
Column
getColumn(Column column)
Return the column which is identified by column provided as argument.Collection<Column>
getColumns()
int
getColumnSpan()
String
getComment()
String
getContributor()
The name of the contributor which contributed thisString
getExportIdentifier()
Get a unique identifier to make sure we are not exporting the same database structure multiple times.Iterator<ForeignKey>
getForeignKeyIterator()
Deprecated, for removal: This API element is subject to removal in a future version.No longer used, should be removedMap<Table.ForeignKeyKey,ForeignKey>
getForeignKeys()
Index
getIndex(String indexName)
Map<String,Index>
getIndexes()
List<InitCommand>
getInitCommands(SqlStringGenerationContext context)
String
getName()
Identifier
getNameIdentifier()
Index
getOrCreateIndex(String indexName)
UniqueKey
getOrCreateUniqueKey(String keyName)
PrimaryKey
getPrimaryKey()
String
getQualifiedName(SqlStringGenerationContext context)
QualifiedTableName
getQualifiedTableName()
String
getQuotedCatalog()
String
getQuotedCatalog(Dialect dialect)
String
getQuotedName()
String
getQuotedName(Dialect dialect)
String
getQuotedSchema()
String
getQuotedSchema(Dialect dialect)
String
getRowId()
String
getSchema()
Identifier
getSchemaIdentifier()
String
getSubselect()
int
getUniqueInteger()
UniqueKey
getUniqueKey(String keyName)
Iterator<UniqueKey>
getUniqueKeyIterator()
Deprecated, for removal: This API element is subject to removal in a future version.No longer used, should be removedMap<String,UniqueKey>
getUniqueKeys()
String
getViewQuery()
boolean
hasDenormalizedTables()
int
hashCode()
boolean
hasPrimaryKey()
boolean
isAbstract()
boolean
isAbstractUnionTable()
boolean
isCatalogQuoted()
boolean
isPhysicalTable()
boolean
isPrimaryKey(Column column)
boolean
isQuoted()
boolean
isSchemaQuoted()
boolean
isSubselect()
boolean
isView()
static String
qualify(String catalog, String schema, String table)
Deprecated.Should build aQualifiedTableName
then useSqlStringGenerationContext.format(QualifiedTableName)
.void
reorderColumns(List<Column> columns)
void
setAbstract(boolean isAbstract)
void
setCatalog(String catalog)
void
setComment(String comment)
void
setName(String name)
void
setPrimaryKey(PrimaryKey primaryKey)
void
setQuoted(boolean quoted)
void
setRowId(String rowId)
void
setSchema(String schema)
void
setSubselect(String subselect)
void
setUniqueInteger(int uniqueInteger)
void
setViewQuery(String viewQuery)
@Remove Iterator<String>
sqlAlterStrings(Dialect dialect, Metadata metadata, TableInformation tableInfo, SqlStringGenerationContext sqlStringGenerationContext)
Deprecated.String
toString()
-
-
-
Constructor Detail
-
Table
@Deprecated(since="6.2", forRemoval=true) public Table()
Deprecated, for removal: This API element is subject to removal in a future version.
-
Table
public Table(String contributor)
-
Table
public Table(String contributor, Namespace namespace, Identifier physicalTableName, boolean isAbstract)
-
Table
public Table(String contributor, Namespace namespace, Identifier physicalTableName, String subselect, boolean isAbstract)
-
-
Method Detail
-
getContributor
public String getContributor()
Description copied from interface:Contributable
The name of the contributor which contributed this- Specified by:
getContributor
in interfaceContributable
-
getQualifiedName
public String getQualifiedName(SqlStringGenerationContext context)
-
qualify
@Deprecated public static String qualify(String catalog, String schema, String table)
Deprecated.Should build aQualifiedTableName
then useSqlStringGenerationContext.format(QualifiedTableName)
.
-
setName
public void setName(String name)
-
getName
public String getName()
-
getNameIdentifier
public Identifier getNameIdentifier()
-
getSchemaIdentifier
public Identifier getSchemaIdentifier()
-
getCatalogIdentifier
public Identifier getCatalogIdentifier()
-
getQuotedName
public String getQuotedName()
-
getQualifiedTableName
public QualifiedTableName getQualifiedTableName()
-
isQuoted
public boolean isQuoted()
-
setQuoted
public void setQuoted(boolean quoted)
-
setSchema
public void setSchema(String schema)
-
getSchema
public String getSchema()
-
getQuotedSchema
public String getQuotedSchema()
-
isSchemaQuoted
public boolean isSchemaQuoted()
-
setCatalog
public void setCatalog(String catalog)
-
getCatalog
public String getCatalog()
-
getQuotedCatalog
public String getQuotedCatalog()
-
isCatalogQuoted
public boolean isCatalogQuoted()
-
getColumn
public Column getColumn(Column column)
Return the column which is identified by column provided as argument.- Parameters:
column
- column with at least a name.- Returns:
- the underlying column or null if not inside this table. Note: the instance *can* be different than the input parameter, but the name will be the same.
-
getColumn
public Column getColumn(Identifier name)
-
getColumn
@Internal public Column getColumn(InFlightMetadataCollector collector, String logicalName)
-
getColumn
public Column getColumn(int n)
-
addColumn
public void addColumn(Column column)
-
getColumnSpan
public int getColumnSpan()
-
getColumns
public Collection<Column> getColumns()
-
getForeignKeyIterator
@Deprecated(since="6.0", forRemoval=true) public Iterator<ForeignKey> getForeignKeyIterator()
Deprecated, for removal: This API element is subject to removal in a future version.No longer used, should be removed
-
getForeignKeys
public Map<Table.ForeignKeyKey,ForeignKey> getForeignKeys()
-
getUniqueKeyIterator
@Deprecated(since="6.0", forRemoval=true) public Iterator<UniqueKey> getUniqueKeyIterator()
Deprecated, for removal: This API element is subject to removal in a future version.No longer used, should be removed
-
equals
public boolean equals(Table table)
-
sqlAlterStrings
@Deprecated(since="6.2") @Remove public @Remove Iterator<String> sqlAlterStrings(Dialect dialect, Metadata metadata, TableInformation tableInfo, SqlStringGenerationContext sqlStringGenerationContext) throws HibernateException
Deprecated.- Throws:
HibernateException
-
isPrimaryKey
public boolean isPrimaryKey(Column column)
-
hasPrimaryKey
public boolean hasPrimaryKey()
-
getPrimaryKey
public PrimaryKey getPrimaryKey()
-
setPrimaryKey
public void setPrimaryKey(PrimaryKey primaryKey)
-
createUniqueKey
public void createUniqueKey(Column column, MetadataBuildingContext context)
Mark the given column unique.
-
createUniqueKey
public void createUniqueKey(List<Column> keyColumns, MetadataBuildingContext context)
If there is one given column, mark it unique, otherwise create aUniqueKey
comprising the given columns.
-
createUniqueKey
@Deprecated(since="6.5", forRemoval=true) public void createUniqueKey(List<Column> keyColumns)
Deprecated, for removal: This API element is subject to removal in a future version.If there is one given column, mark it unique, otherwise create aUniqueKey
comprising the given columns.
-
createForeignKeys
public void createForeignKeys(MetadataBuildingContext context)
-
createForeignKey
public ForeignKey createForeignKey(String keyName, List<Column> keyColumns, String referencedEntityName, String keyDefinition)
-
createForeignKey
public ForeignKey createForeignKey(String keyName, List<Column> keyColumns, String referencedEntityName, String keyDefinition, List<Column> referencedColumns)
-
setUniqueInteger
public void setUniqueInteger(int uniqueInteger)
-
getUniqueInteger
public int getUniqueInteger()
-
addCheckConstraint
@Deprecated(since="6.2") public void addCheckConstraint(String constraint)
Deprecated.
-
addCheck
public void addCheck(CheckConstraint check)
-
containsColumn
public boolean containsColumn(Column column)
-
getRowId
public String getRowId()
-
setRowId
public void setRowId(String rowId)
-
getSubselect
public String getSubselect()
-
setSubselect
public void setSubselect(String subselect)
-
isSubselect
public boolean isSubselect()
-
isAbstractUnionTable
public boolean isAbstractUnionTable()
-
hasDenormalizedTables
public boolean hasDenormalizedTables()
-
setAbstract
public void setAbstract(boolean isAbstract)
-
isAbstract
public boolean isAbstract()
-
isPhysicalTable
public boolean isPhysicalTable()
-
isView
public boolean isView()
-
getComment
public String getComment()
-
setComment
public void setComment(String comment)
-
getCheckConstraintsIterator
@Deprecated(since="6.0", forRemoval=true) public Iterator<String> getCheckConstraintsIterator()
Deprecated, for removal: This API element is subject to removal in a future version.No longer used, should be removed
-
getCheckConstraints
@Deprecated(since="6.2", forRemoval=true) public List<String> getCheckConstraints()
Deprecated, for removal: This API element is subject to removal in a future version.No longer used, should be removed
-
getChecks
public List<CheckConstraint> getChecks()
-
getExportIdentifier
public String getExportIdentifier()
Description copied from interface:Exportable
Get a unique identifier to make sure we are not exporting the same database structure multiple times.- Specified by:
getExportIdentifier
in interfaceExportable
- Returns:
- The exporting identifier.
-
getViewQuery
public String getViewQuery()
-
setViewQuery
public void setViewQuery(String viewQuery)
-
addInitCommand
@Deprecated public void addInitCommand(InitCommand command)
Deprecated.UseaddInitCommand(Function)
instead.
-
addInitCommand
public void addInitCommand(Function<SqlStringGenerationContext,InitCommand> commandProducer)
-
getInitCommands
public List<InitCommand> getInitCommands(SqlStringGenerationContext context)
-
-