Package org.hibernate.mapping
Class Column
- java.lang.Object
-
- org.hibernate.mapping.Column
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Selectable
,ColumnTypeInformation
- Direct Known Subclasses:
AggregateColumn
,ExportableColumn
public class Column extends Object implements Selectable, Serializable, Cloneable, ColumnTypeInformation
A mapping model object representing a column of a relational database table.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.hibernate.tool.schema.extract.spi.ColumnTypeInformation
EMPTY
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
checkConstraint()
Column
clone()
Shallow copy, the value is not copiedboolean
equals(Object object)
boolean
equals(Column column)
String
getAlias(Dialect dialect)
String
getAlias(Dialect dialect, Table table)
Generate a column alias that is unique across multiple tablesString
getAssignmentExpression()
String
getCanonicalName()
String
getCheckConstraint()
int
getColumnSize()
The column size (length).Size
getColumnSize(Dialect dialect, Mapping mapping)
String
getComment()
String
getCustomRead()
String
getCustomReadExpression()
Any custom read expression for this selectable.String
getCustomWrite()
String
getCustomWriteExpression()
Any custom write expression for this selectable.int
getDecimalDigits()
The precision, for numeric typesString
getDefaultValue()
String
getGeneratedAs()
Long
getLength()
String
getName()
TruthValue
getNullable()
Is the column nullable.Integer
getPrecision()
String
getQuotedName()
returns quoted name as it would be in the mapping file.String
getQuotedName(Dialect d)
String
getReadExpr(Dialect dialect)
Integer
getScale()
String
getSpecializedTypeDeclaration()
String
getSqlType()
String
getSqlType(Metadata mapping)
String
getSqlType(TypeConfiguration typeConfiguration, Dialect dialect, Mapping mapping)
Deprecated.Integer
getSqlTypeCode()
Returns SQL type code for this column, ornull
if the type code is unknown.int
getSqlTypeCode(Mapping mapping)
String
getTemplate(Dialect dialect, TypeConfiguration typeConfiguration, SqmFunctionRegistry functionRegistry)
String
getText()
The selectable's "canonical" text representationString
getText(Dialect d)
The selectable's text representation accounting for the Dialect's quoting, if quotedint
getTypeCode()
The JDBC type-code.int
getTypeIndex()
String
getTypeName()
The database specific type name.Value
getValue()
String
getWriteExpr()
boolean
hasCheckConstraint()
boolean
hasCustomRead()
int
hashCode()
boolean
hasSpecializedTypeDeclaration()
boolean
isFormula()
Does this selectable represent a formula?true
indicates it is a formula;false
indicates it is a physical columnboolean
isNullable()
boolean
isQuoted()
boolean
isUnique()
void
setAssignmentExpression(String assignmentExpression)
void
setCheckConstraint(String checkConstraint)
void
setComment(String comment)
void
setCustomRead(String customRead)
void
setCustomWrite(String customWrite)
void
setDefaultValue(String defaultValue)
void
setGeneratedAs(String generatedAs)
void
setLength(Integer length)
void
setLength(Long length)
void
setName(String name)
void
setNullable(boolean nullable)
void
setPrecision(Integer precision)
void
setResolvedCustomRead(String customRead)
void
setScale(Integer scale)
void
setSpecializedTypeDeclaration(String specializedTypeDeclaration)
void
setSqlType(String sqlType)
void
setSqlTypeCode(Integer typeCode)
void
setTypeIndex(int typeIndex)
void
setUnique(boolean unique)
void
setValue(Value value)
String
toString()
-
-
-
Constructor Detail
-
Column
public Column()
-
Column
public Column(String columnName)
-
-
Method Detail
-
getLength
public Long getLength()
-
setLength
public void setLength(Long length)
-
setLength
public void setLength(Integer length)
-
getValue
public Value getValue()
-
setValue
public void setValue(Value value)
-
getName
public String getName()
-
setName
public void setName(String name)
-
getQuotedName
public String getQuotedName()
returns quoted name as it would be in the mapping file.
-
getAlias
public String getAlias(Dialect dialect)
- Specified by:
getAlias
in interfaceSelectable
-
getAlias
public String getAlias(Dialect dialect, Table table)
Generate a column alias that is unique across multiple tables- Specified by:
getAlias
in interfaceSelectable
-
isNullable
public boolean isNullable()
-
setNullable
public void setNullable(boolean nullable)
-
getTypeIndex
public int getTypeIndex()
-
setTypeIndex
public void setTypeIndex(int typeIndex)
-
isUnique
public boolean isUnique()
-
equals
public boolean equals(Column column)
-
getSqlTypeCode
public int getSqlTypeCode(Mapping mapping) throws MappingException
- Throws:
MappingException
-
getSqlTypeCode
public Integer getSqlTypeCode()
Returns SQL type code for this column, ornull
if the type code is unknown.Use
getSqlTypeCode(Mapping)
to retrieve the type code usingValue
associated with the column.- Returns:
- sqlTypeCode if it is set, otherwise null.
-
setSqlTypeCode
public void setSqlTypeCode(Integer typeCode)
-
getSqlType
public String getSqlType(Metadata mapping) throws HibernateException
- Throws:
HibernateException
-
getSqlType
@Deprecated(since="6.2") public String getSqlType(TypeConfiguration typeConfiguration, Dialect dialect, Mapping mapping) throws HibernateException
Deprecated.- Throws:
HibernateException
-
getTypeName
public String getTypeName()
Description copied from interface:ColumnTypeInformation
The database specific type name.- Specified by:
getTypeName
in interfaceColumnTypeInformation
- Returns:
- Type name
-
getNullable
public TruthValue getNullable()
Description copied from interface:ColumnTypeInformation
Is the column nullable. The database is allowed to report unknown, hence the use of TruthValue- Specified by:
getNullable
in interfaceColumnTypeInformation
- Returns:
- nullability.
-
getTypeCode
public int getTypeCode()
Description copied from interface:ColumnTypeInformation
The JDBC type-code.- Specified by:
getTypeCode
in interfaceColumnTypeInformation
- Returns:
- JDBC type-code
-
getColumnSize
public int getColumnSize()
Description copied from interface:ColumnTypeInformation
The column size (length).- Specified by:
getColumnSize
in interfaceColumnTypeInformation
- Returns:
- The column length
-
getDecimalDigits
public int getDecimalDigits()
Description copied from interface:ColumnTypeInformation
The precision, for numeric types- Specified by:
getDecimalDigits
in interfaceColumnTypeInformation
- Returns:
- The numeric precision
-
getSqlType
public String getSqlType()
-
setSqlType
public void setSqlType(String sqlType)
-
setUnique
public void setUnique(boolean unique)
-
isQuoted
public boolean isQuoted()
-
setSpecializedTypeDeclaration
public void setSpecializedTypeDeclaration(String specializedTypeDeclaration)
-
getSpecializedTypeDeclaration
public String getSpecializedTypeDeclaration()
-
hasSpecializedTypeDeclaration
public boolean hasSpecializedTypeDeclaration()
-
getCheckConstraint
public String getCheckConstraint()
-
setCheckConstraint
public void setCheckConstraint(String checkConstraint)
-
hasCheckConstraint
public boolean hasCheckConstraint()
-
checkConstraint
public String checkConstraint()
-
getTemplate
public String getTemplate(Dialect dialect, TypeConfiguration typeConfiguration, SqmFunctionRegistry functionRegistry)
- Specified by:
getTemplate
in interfaceSelectable
-
hasCustomRead
public boolean hasCustomRead()
-
getWriteExpr
public String getWriteExpr()
-
isFormula
public boolean isFormula()
Description copied from interface:Selectable
Does this selectable represent a formula?true
indicates it is a formula;false
indicates it is a physical column- Specified by:
isFormula
in interfaceSelectable
-
getText
public String getText(Dialect d)
Description copied from interface:Selectable
The selectable's text representation accounting for the Dialect's quoting, if quoted- Specified by:
getText
in interfaceSelectable
-
getText
public String getText()
Description copied from interface:Selectable
The selectable's "canonical" text representation- Specified by:
getText
in interfaceSelectable
-
getCustomReadExpression
public String getCustomReadExpression()
Description copied from interface:Selectable
Any custom read expression for this selectable. Only pertinent for physical columns (not formulas)- Specified by:
getCustomReadExpression
in interfaceSelectable
- See Also:
ColumnTransformer
-
getCustomWriteExpression
public String getCustomWriteExpression()
Description copied from interface:Selectable
Any custom write expression for this selectable. Only pertinent for physical columns (not formulas)- Specified by:
getCustomWriteExpression
in interfaceSelectable
- See Also:
ColumnTransformer
-
getPrecision
public Integer getPrecision()
-
setPrecision
public void setPrecision(Integer precision)
-
getScale
public Integer getScale()
-
setScale
public void setScale(Integer scale)
-
getComment
public String getComment()
-
setComment
public void setComment(String comment)
-
getDefaultValue
public String getDefaultValue()
-
setDefaultValue
public void setDefaultValue(String defaultValue)
-
getGeneratedAs
public String getGeneratedAs()
-
setGeneratedAs
public void setGeneratedAs(String generatedAs)
-
getAssignmentExpression
public String getAssignmentExpression()
-
setAssignmentExpression
public void setAssignmentExpression(String assignmentExpression)
-
getCustomWrite
public String getCustomWrite()
-
setCustomWrite
public void setCustomWrite(String customWrite)
-
getCustomRead
public String getCustomRead()
-
setResolvedCustomRead
public void setResolvedCustomRead(String customRead)
-
setCustomRead
public void setCustomRead(String customRead)
-
getCanonicalName
public String getCanonicalName()
-
-