org.hibernate.mapping
Class Column

java.lang.Object
  extended by org.hibernate.mapping.Column
All Implemented Interfaces:
Serializable, Cloneable, Selectable

public class Column
extends Object
implements Selectable, Serializable, Cloneable

A column of a relational database table

Author:
Gavin King
See Also:
Serialized Form

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(Column column)
           
 boolean equals(Object object)
           
 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 getCustomRead()
           
 String getCustomWrite()
           
 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)
           
 String getReadExpr(Dialect dialect)
           
 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()
           
 String getWriteExpr()
           
 boolean hasCheckConstraint()
           
 int hashCode()
           
 boolean isFormula()
           
 boolean isNullable()
           
 boolean isQuoted()
           
 boolean isUnique()
           
 void setCheckConstraint(String checkConstraint)
           
 void setComment(String comment)
           
 void setCustomRead(String customRead)
           
 void setCustomWrite(String customWrite)
           
 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()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_LENGTH

public static final int DEFAULT_LENGTH
See Also:
Constant Field Values

DEFAULT_PRECISION

public static final int DEFAULT_PRECISION
See Also:
Constant Field Values

DEFAULT_SCALE

public static final int DEFAULT_SCALE
See Also:
Constant Field Values
Constructor Detail

Column

public Column()

Column

public Column(String columnName)
Method Detail

getLength

public int getLength()

setLength

public void setLength(int 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.


getQuotedName

public String getQuotedName(Dialect d)

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

isNullable

public boolean isNullable()

setNullable

public void setNullable(boolean nullable)

getTypeIndex

public int getTypeIndex()

setTypeIndex

public void setTypeIndex(int typeIndex)

getSqlTypeCode

public int getSqlTypeCode(Mapping mapping)
                   throws MappingException
Throws:
MappingException

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.

setSqlTypeCode

public void setSqlTypeCode(Integer typecode)

isUnique

public boolean isUnique()

getSqlType

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

equals

public boolean equals(Object object)
Overrides:
equals in class Object

equals

public boolean equals(Column column)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getSqlType

public String getSqlType()

setSqlType

public void setSqlType(String sqlType)

setUnique

public void setUnique(boolean unique)

isQuoted

public boolean isQuoted()

toString

public String toString()
Overrides:
toString in class Object

getCheckConstraint

public String getCheckConstraint()

setCheckConstraint

public void setCheckConstraint(String checkConstraint)

hasCheckConstraint

public boolean hasCheckConstraint()

getTemplate

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

getReadExpr

public String getReadExpr(Dialect dialect)

getWriteExpr

public String getWriteExpr()

isFormula

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

getText

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

getText

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

getPrecision

public int getPrecision()

setPrecision

public void setPrecision(int scale)

getScale

public int getScale()

setScale

public void setScale(int scale)

getComment

public String getComment()

setComment

public void setComment(String comment)

getDefaultValue

public String getDefaultValue()

setDefaultValue

public void setDefaultValue(String defaultValue)

getCustomWrite

public String getCustomWrite()

setCustomWrite

public void setCustomWrite(String customWrite)

getCustomRead

public String getCustomRead()

setCustomRead

public void setCustomRead(String customRead)

getCanonicalName

public String getCanonicalName()

clone

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

Overrides:
clone in class Object


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.