Package org.hibernate.mapping
Class Table
- java.lang.Object
-
- org.hibernate.mapping.Table
-
- All Implemented Interfaces:
java.io.Serializable
,Exportable
,RelationalModel
- Direct Known Subclasses:
DenormalizedTable
public class Table extends java.lang.Object implements RelationalModel, java.io.Serializable, Exportable
A relational 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()
Table(java.lang.String name)
Table(Identifier catalog, Identifier schema, Identifier physicalTableName, boolean isAbstract)
Table(Namespace namespace, java.lang.String subselect, boolean isAbstract)
Table(Namespace namespace, Identifier physicalTableName, boolean isAbstract)
Table(Namespace namespace, Identifier physicalTableName, java.lang.String subselect, boolean isAbstract)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addCheckConstraint(java.lang.String constraint)
void
addColumn(Column column)
Index
addIndex(Index index)
void
addInitCommand(java.util.function.Function<SqlStringGenerationContext,InitCommand> commandProducer)
void
addInitCommand(InitCommand command)
Deprecated.UseaddInitCommand(Function)
instead.UniqueKey
addUniqueKey(UniqueKey uniqueKey)
boolean
containsColumn(Column column)
ForeignKey
createForeignKey(java.lang.String keyName, java.util.List<Column> keyColumns, java.lang.String referencedEntityName, java.lang.String keyDefinition)
ForeignKey
createForeignKey(java.lang.String keyName, java.util.List<Column> keyColumns, java.lang.String referencedEntityName, java.lang.String keyDefinition, java.util.List<Column> referencedColumns)
void
createForeignKeys()
UniqueKey
createUniqueKey(java.util.List<Column> keyColumns)
boolean
equals(java.lang.Object object)
boolean
equals(Table table)
java.lang.String
getCatalog()
java.util.Iterator<java.lang.String>
getCheckConstraintsIterator()
Column
getColumn(int n)
Column
getColumn(Identifier name)
Column
getColumn(Column column)
Return the column which is identified by column provided as argument.java.util.Iterator<Column>
getColumnIterator()
int
getColumnSpan()
java.lang.String
getComment()
java.lang.String
getExportIdentifier()
Get a unique identifier to make sure we are not exporting the same database structure multiple times.java.util.Iterator<ForeignKey>
getForeignKeyIterator()
java.util.Map<Table.ForeignKeyKey,ForeignKey>
getForeignKeys()
KeyValue
getIdentifierValue()
Index
getIndex(java.lang.String indexName)
java.util.Iterator<Index>
getIndexIterator()
java.util.List<InitCommand>
getInitCommands(SqlStringGenerationContext context)
java.lang.String
getName()
Identifier
getNameIdentifier()
Index
getOrCreateIndex(java.lang.String indexName)
UniqueKey
getOrCreateUniqueKey(java.lang.String keyName)
PrimaryKey
getPrimaryKey()
java.lang.String
getQualifiedName(SqlStringGenerationContext context)
QualifiedTableName
getQualifiedTableName()
java.lang.String
getQuotedCatalog()
java.lang.String
getQuotedCatalog(Dialect dialect)
java.lang.String
getQuotedName()
java.lang.String
getQuotedName(Dialect dialect)
java.lang.String
getQuotedSchema()
java.lang.String
getQuotedSchema(Dialect dialect)
java.lang.String
getRowId()
java.lang.String
getSchema()
java.lang.String
getSubselect()
int
getUniqueInteger()
UniqueKey
getUniqueKey(java.lang.String keyName)
java.util.Iterator<UniqueKey>
getUniqueKeyIterator()
boolean
hasDenormalizedTables()
int
hashCode()
boolean
hasPrimaryKey()
boolean
isAbstract()
boolean
isAbstractUnionTable()
boolean
isCatalogQuoted()
boolean
isPhysicalTable()
boolean
isQuoted()
boolean
isSchemaQuoted()
boolean
isSubselect()
static java.lang.String
qualify(java.lang.String catalog, java.lang.String schema, java.lang.String table)
Deprecated.Should build aQualifiedTableName
then useSqlStringGenerationContext.format(QualifiedTableName)
.void
setAbstract(boolean isAbstract)
void
setCatalog(java.lang.String catalog)
void
setComment(java.lang.String comment)
void
setIdentifierValue(KeyValue idValue)
void
setName(java.lang.String name)
void
setPrimaryKey(PrimaryKey primaryKey)
void
setQuoted(boolean quoted)
void
setRowId(java.lang.String rowId)
void
setSchema(java.lang.String schema)
void
setSubselect(java.lang.String subselect)
void
setUniqueInteger(int uniqueInteger)
java.util.Iterator<java.lang.String>
sqlAlterStrings(Dialect dialect, Metadata metadata, TableInformation tableInfo, SqlStringGenerationContext sqlStringGenerationContext)
java.lang.String
sqlCreateString(Mapping p, SqlStringGenerationContext context, java.lang.String defaultCatalog, java.lang.String defaultSchema)
java.lang.String
sqlDropString(SqlStringGenerationContext context, java.lang.String defaultCatalog, java.lang.String defaultSchema)
java.lang.String
toString()
void
validateColumns(Dialect dialect, Mapping mapping, TableMetadata tableInfo)
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hibernate.mapping.RelationalModel
sqlCreateString, sqlDropString
-
-
-
-
Constructor Detail
-
Table
public Table()
-
Table
public Table(java.lang.String name)
-
Table
public Table(Namespace namespace, Identifier physicalTableName, boolean isAbstract)
-
Table
public Table(Identifier catalog, Identifier schema, Identifier physicalTableName, boolean isAbstract)
-
Table
public Table(Namespace namespace, Identifier physicalTableName, java.lang.String subselect, boolean isAbstract)
-
Table
public Table(Namespace namespace, java.lang.String subselect, boolean isAbstract)
-
-
Method Detail
-
getQualifiedName
public java.lang.String getQualifiedName(SqlStringGenerationContext context)
-
qualify
@Deprecated public static java.lang.String qualify(java.lang.String catalog, java.lang.String schema, java.lang.String table)
Deprecated.Should build aQualifiedTableName
then useSqlStringGenerationContext.format(QualifiedTableName)
.
-
setName
public void setName(java.lang.String name)
-
getName
public java.lang.String getName()
-
getNameIdentifier
public Identifier getNameIdentifier()
-
getQuotedName
public java.lang.String getQuotedName()
-
getQuotedName
public java.lang.String getQuotedName(Dialect dialect)
-
getQualifiedTableName
public QualifiedTableName getQualifiedTableName()
-
isQuoted
public boolean isQuoted()
-
setQuoted
public void setQuoted(boolean quoted)
-
setSchema
public void setSchema(java.lang.String schema)
-
getSchema
public java.lang.String getSchema()
-
getQuotedSchema
public java.lang.String getQuotedSchema()
-
getQuotedSchema
public java.lang.String getQuotedSchema(Dialect dialect)
-
isSchemaQuoted
public boolean isSchemaQuoted()
-
setCatalog
public void setCatalog(java.lang.String catalog)
-
getCatalog
public java.lang.String getCatalog()
-
getQuotedCatalog
public java.lang.String getQuotedCatalog()
-
getQuotedCatalog
public java.lang.String getQuotedCatalog(Dialect dialect)
-
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
public Column getColumn(int n)
-
addColumn
public void addColumn(Column column)
-
getColumnSpan
public int getColumnSpan()
-
getColumnIterator
public java.util.Iterator<Column> getColumnIterator()
-
getIndexIterator
public java.util.Iterator<Index> getIndexIterator()
-
getForeignKeyIterator
public java.util.Iterator<ForeignKey> getForeignKeyIterator()
-
getForeignKeys
public java.util.Map<Table.ForeignKeyKey,ForeignKey> getForeignKeys()
-
getUniqueKeyIterator
public java.util.Iterator<UniqueKey> getUniqueKeyIterator()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equals
in classjava.lang.Object
-
equals
public boolean equals(Table table)
-
validateColumns
public void validateColumns(Dialect dialect, Mapping mapping, TableMetadata tableInfo)
-
sqlAlterStrings
public java.util.Iterator<java.lang.String> sqlAlterStrings(Dialect dialect, Metadata metadata, TableInformation tableInfo, SqlStringGenerationContext sqlStringGenerationContext) throws HibernateException
- Throws:
HibernateException
-
hasPrimaryKey
public boolean hasPrimaryKey()
-
sqlCreateString
public java.lang.String sqlCreateString(Mapping p, SqlStringGenerationContext context, java.lang.String defaultCatalog, java.lang.String defaultSchema)
- Specified by:
sqlCreateString
in interfaceRelationalModel
-
sqlDropString
public java.lang.String sqlDropString(SqlStringGenerationContext context, java.lang.String defaultCatalog, java.lang.String defaultSchema)
- Specified by:
sqlDropString
in interfaceRelationalModel
-
getPrimaryKey
public PrimaryKey getPrimaryKey()
-
setPrimaryKey
public void setPrimaryKey(PrimaryKey primaryKey)
-
getOrCreateIndex
public Index getOrCreateIndex(java.lang.String indexName)
-
getIndex
public Index getIndex(java.lang.String indexName)
-
getUniqueKey
public UniqueKey getUniqueKey(java.lang.String keyName)
-
getOrCreateUniqueKey
public UniqueKey getOrCreateUniqueKey(java.lang.String keyName)
-
createForeignKeys
public void createForeignKeys()
-
createForeignKey
public ForeignKey createForeignKey(java.lang.String keyName, java.util.List<Column> keyColumns, java.lang.String referencedEntityName, java.lang.String keyDefinition)
-
createForeignKey
public ForeignKey createForeignKey(java.lang.String keyName, java.util.List<Column> keyColumns, java.lang.String referencedEntityName, java.lang.String keyDefinition, java.util.List<Column> referencedColumns)
-
setUniqueInteger
public void setUniqueInteger(int uniqueInteger)
-
getUniqueInteger
public int getUniqueInteger()
-
setIdentifierValue
public void setIdentifierValue(KeyValue idValue)
-
getIdentifierValue
public KeyValue getIdentifierValue()
-
addCheckConstraint
public void addCheckConstraint(java.lang.String constraint)
-
containsColumn
public boolean containsColumn(Column column)
-
getRowId
public java.lang.String getRowId()
-
setRowId
public void setRowId(java.lang.String rowId)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getSubselect
public java.lang.String getSubselect()
-
setSubselect
public void setSubselect(java.lang.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()
-
getComment
public java.lang.String getComment()
-
setComment
public void setComment(java.lang.String comment)
-
getCheckConstraintsIterator
public java.util.Iterator<java.lang.String> getCheckConstraintsIterator()
-
getExportIdentifier
public java.lang.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.
-
addInitCommand
@Deprecated public void addInitCommand(InitCommand command)
Deprecated.UseaddInitCommand(Function)
instead.
-
addInitCommand
public void addInitCommand(java.util.function.Function<SqlStringGenerationContext,InitCommand> commandProducer)
-
getInitCommands
public java.util.List<InitCommand> getInitCommands(SqlStringGenerationContext context)
-
-