org.hibernate.mapping

Class Column

Implemented Interfaces:
Cloneable, Selectable, Serializable

public class Column
extends java.lang.Object
implements Selectable, Serializable, Cloneable

A column of a relational database table
Author:
Gavin King

Field Summary

static int
DEFAULT_LENGTH
static int
DEFAULT_PRECISION
static int
DEFAULT_SCALE

Constructor Summary

Column()
Column(String columnName)

Method Summary

protected Object
clone()
Shallow copy, the value is not copied
boolean
equals(Object object)
boolean
equals(Column column)
String
getAlias(Dialect dialect)
For any column name, generate an alias that is unique to that column name, and also 10 characters or less in length.
String
getAlias(Dialect dialect, Table table)
Generate a column alias that is unique across multiple tables
String
getCanonicalName()
String
getCheckConstraint()
String
getComment()
String
getDefaultValue()
int
getLength()
String
getName()
int
getPrecision()
String
getQuotedName()
returns quoted name as it would be in the mapping file.
String
getQuotedName(Dialect d)
int
getScale()
String
getSqlType()
String
getSqlType(Dialect dialect, Mapping mapping)
Integer
getSqlTypeCode()
Returns the underlying columns sqltypecode.
int
getSqlTypeCode(Mapping mapping)
String
getTemplate(Dialect dialect, SQLFunctionRegistry functionRegistry)
String
getText()
String
getText(Dialect d)
int
getTypeIndex()
Value
getValue()
boolean
hasCheckConstraint()
int
hashCode()
boolean
isFormula()
boolean
isNullable()
boolean
isQuoted()
boolean
isUnique()
void
setCheckConstraint(String checkConstraint)
void
setComment(String comment)
void
setDefaultValue(String defaultValue)
void
setLength(int length)
void
setName(String name)
void
setNullable(boolean nullable)
void
setPrecision(int scale)
void
setScale(int scale)
void
setSqlType(String sqlType)
void
setSqlTypeCode(Integer typecode)
void
setTypeIndex(int typeIndex)
void
setUnique(boolean unique)
void
setValue(Value value)
String
toString()

Field Details

DEFAULT_LENGTH

public static final int DEFAULT_LENGTH
Field Value:
255

DEFAULT_PRECISION

public static final int DEFAULT_PRECISION
Field Value:
19

DEFAULT_SCALE

public static final int DEFAULT_SCALE
Field Value:
2

Constructor Details

Column

public Column()

Column

public Column(String columnName)

Method Details

clone

protected Object clone()
Shallow copy, the value is not copied

equals

public boolean equals(Object object)

equals

public boolean equals(Column column)

getAlias

public String getAlias(Dialect dialect)
For any column name, generate an alias that is unique to that column name, and also 10 characters or less in length.
Specified by:
getAlias in interface Selectable

getAlias

public String getAlias(Dialect dialect,
                       Table table)
Generate a column alias that is unique across multiple tables
Specified by:
getAlias in interface Selectable

getCanonicalName

public String getCanonicalName()

getCheckConstraint

public String getCheckConstraint()

getComment

public String getComment()

getDefaultValue

public String getDefaultValue()

getLength

public int getLength()

getName

public String getName()

getPrecision

public int getPrecision()

getQuotedName

public String getQuotedName()
returns quoted name as it would be in the mapping file.

getQuotedName

public String getQuotedName(Dialect d)

getScale

public int getScale()

getSqlType

public String getSqlType()

getSqlType

public String getSqlType(Dialect dialect,
                         Mapping mapping)
            throws HibernateException

getSqlTypeCode

public Integer getSqlTypeCode()
Returns the underlying columns sqltypecode. If null, it is because the sqltype code is unknown. Use #getSqlTypeCode(Mapping) to retreive the sqltypecode used for the columns associated Value/Type.
Returns:
sqltypecode if it is set, otherwise null.

getSqlTypeCode

public int getSqlTypeCode(Mapping mapping)
            throws MappingException

getTemplate

public String getTemplate(Dialect dialect,
                          SQLFunctionRegistry functionRegistry)
Specified by:
getTemplate in interface Selectable

getText

public String getText()
Specified by:
getText in interface Selectable

getText

public String getText(Dialect d)
Specified by:
getText in interface Selectable

getTypeIndex

public int getTypeIndex()

getValue

public Value getValue()

hasCheckConstraint

public boolean hasCheckConstraint()

hashCode

public int hashCode()

isFormula

public boolean isFormula()
Specified by:
isFormula in interface Selectable

isNullable

public boolean isNullable()

isQuoted

public boolean isQuoted()

isUnique

public boolean isUnique()

setCheckConstraint

public void setCheckConstraint(String checkConstraint)

setComment

public void setComment(String comment)

setDefaultValue

public void setDefaultValue(String defaultValue)

setLength

public void setLength(int length)

setName

public void setName(String name)

setNullable

public void setNullable(boolean nullable)

setPrecision

public void setPrecision(int scale)

setScale

public void setScale(int scale)

setSqlType

public void setSqlType(String sqlType)

setSqlTypeCode

public void setSqlTypeCode(Integer typecode)

setTypeIndex

public void setTypeIndex(int typeIndex)

setUnique

public void setUnique(boolean unique)

setValue

public void setValue(Value value)

toString

public String toString()