Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.openjpa.jdbc.schema
Class Column

    java.lang.Object
      org.apache.openjpa.jdbc.schema.Column

    public class Column

extends Object

Represents a database column. Closely aligned with the column information available from `DatabaseMetaData`.

Author:
  Abe White, Stephen Kim

Field Summary
`static int` | `FLAG_DIRECT_INSERT`
`static int` | `FLAG_DIRECT_UPDATE`
`static int` | `FLAG_FK_INSERT`
`static int` | `FLAG_FK_UPDATE`
`static int` | `FLAG_PK_JOIN`
`static int` | `FLAG_UNINSERTABLE`
`static int` | `FLAG_UNUPDATABLE`

Constructor Summary
`Column()` Default constructor.
`Column(String name, Table table)` Constructor.

Method Summary
`void` | `copy(Column from)` Copy information from the given column to this one.
`void` | `deref()`
`boolean` | `equalsColumn(Column col)` Tests compatibility.
`int` | `getDecimalDigits()` Return the number of decimal digits for the column, if applicable.
`Object` | `getDefault()` Return the default value set for this column, if any.
`String` | `getDefaultString()` Return the default value set for the column, if any.
`String` | `getDescription()` Useful for debugging.
`boolean` | `getFlag(int flag)` Flags are used for bookkeeping information.
`String` | `getFullName()` Return the column's full name, in the form <table>.<name>.
`int` | `getIndex()` Return the column's 0-based index in the owning table.
`int` | `getJavaType()` The Java type the data in this column is treated as, from `JavaTypes` or `JavaSQLTypes`.
`String` | `getName()` Return the column's name.
`int` | `getRefCount()`
`String` | `getSchemaName()` The column's schema name.
`int` | `getSize()` Return the column's size.
`Table` | `getTable()` Return the table for the column.
`String` | `getTableName()` The column's table name.
`String` | `getTarget()` The name of the column this column joins to, if any.
`String` | `getTargetField()` The name of the field this column joins to, if any.
`int` | `getType()` Return the column's SQL type.
`String` | `getTypeName()` The database-specific SQL type of this column.
`boolean` | `isAutoAssigned()` Whether this column is auto-assigned a value on insert.
`boolean` | `isCompatible(int type, int size)` Return true if this column is compatible with the given JDBC type from `Types` and size.
`boolean` | `isLob()` Whether this column is a LOB.
`boolean` | `isNotNull()` Return true if this is a NOT NULL column.
`boolean` | `isNotNullExplicit()` Whether the not-null property has been set.
`boolean` | `isPrimaryKey()` Return true if this column belongs to the table's primary key.
`boolean` | `isRelationId()` Whether this column stores some form of serialized identity value for a related record.
`void` | `ref()`
`void` | `setAutoAssigned(boolean autoAssign)` Whether this column is auto-incrementing.
`void` | `setDecimalDigits(int digits)` Set the number of decimal digits for the column.
`void` | `setDefault(Object def)` Set the default value for the column.
`void` | `setDefaultString(String def)` Set the default value for the column.
`void` | `setFlag(int flag, boolean on)` Flags are used for bookkeeping information.
`void` | `setJavaType(int type)` The Java type the data in this column is treated as, from `JavaTypes` or `JavaSQLTypes`.
`void` | `setName(String name)` Set the column's name.
`void` | `setNotNull(boolean notNull)` Set whether this is a NOT NULL column.
`void` | `setRelationId(boolean rel)` Whether this column stores some form of serialized identity value for a related record.
`void` | `setSchemaName(String name)` The column's schema name.
`void` | `setSize(int size)` Set the column's size.
`void` | `setTableName(String name)` The column's table name.
`void` | `setTarget(String target)` The name of the column this column joins to, if any.
`void` | `setTargetField(String target)` The name of the field this column joins to, if any.
`void` | `setType(int sqlType)` Set the column's SQL type.
`void` | `setTypeName(String typeName)` The database-specific SQL type of this column.
`String` | `toString()` Returns the column name.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### FLAG_UNINSERTABLE

    public static final int FLAG_UNINSERTABLE

See Also:
  Constant Field Values

### FLAG_UNUPDATABLE

    public static final int FLAG_UNUPDATABLE

See Also:
  Constant Field Values

### FLAG_DIRECT_INSERT

    public static final int FLAG_DIRECT_INSERT

See Also:
  Constant Field Values

### FLAG_DIRECT_UPDATE

    public static final int FLAG_DIRECT_UPDATE

See Also:
  Constant Field Values

### FLAG_FK_INSERT

    public static final int FLAG_FK_INSERT

See Also:
  Constant Field Values

### FLAG_FK_UPDATE

    public static final int FLAG_FK_UPDATE

See Also:
  Constant Field Values

### FLAG_PK_JOIN

    public static final int FLAG_PK_JOIN

See Also:
  Constant Field Values

Constructor Detail

### Column

    public Column()

  Default constructor.

### Column

    public Column(String name,
                  Table table)

  Constructor.

  Parameters:
    `name` - the name of the column
    `table` - the column's table

Method Detail

### getTable

    public Table getTable()

  Return the table for the column.

### getTableName

    public String getTableName()

  The column's table name.

### setTableName

    public void setTableName(String name)

  The column's table name. You can only call this method on columns whose table object is not set.

### getSchemaName

    public String getSchemaName()

  The column's schema name.

### setSchemaName

    public void setSchemaName(String name)

  The column's schema name. You can only call this method on columns whose table object is not set.

### getName

    public String getName()

  Return the column's name.

### setName

    public void setName(String name)

  Set the column's name. You can only call this method on columns whose table object is not set.

### getFullName

    public String getFullName()

  Return the column's full name, in the form <table>.<name>.

### getType

    public int getType()

  Return the column's SQL type. This will be one of the type constants defined in `Types`.

### setType

    public void setType(int sqlType)

  Set the column's SQL type. This should be one of the type constants defined in `Types`.

### getTypeName

    public String getTypeName()

  The database-specific SQL type of this column.

### setTypeName

    public void setTypeName(String typeName)

  The database-specific SQL type of this column.

### getJavaType

    public int getJavaType()

  The Java type the data in this column is treated as, from `JavaTypes` or `JavaSQLTypes`.

### setJavaType

    public void setJavaType(int type)

  The Java type the data in this column is treated as, from `JavaTypes` or `JavaSQLTypes`.

### getSize

    public int getSize()

  Return the column's size.

### setSize

    public void setSize(int size)

  Set the column's size.

### getDecimalDigits

    public int getDecimalDigits()

  Return the number of decimal digits for the column, if applicable.

### setDecimalDigits

    public void setDecimalDigits(int digits)

  Set the number of decimal digits for the column.

### getDefaultString

    public String getDefaultString()

  Return the default value set for the column, if any.

### setDefaultString

    public void setDefaultString(String def)

  Set the default value for the column.

### getDefault

    public Object getDefault()

  Return the default value set for this column, if any. If only a default string has been set, attempts to convert it to the right type based on the Java type set for this column.

### setDefault

    public void setDefault(Object def)

  Set the default value for the column.

### isNotNull

    public boolean isNotNull()

  Return true if this is a NOT NULL column.

### setNotNull

    public void setNotNull(boolean notNull)

  Set whether this is a NOT NULL column.

### isNotNullExplicit

    public boolean isNotNullExplicit()

  Whether the not-null property has been set.

### isAutoAssigned

    public boolean isAutoAssigned()

  Whether this column is auto-assigned a value on insert.

### setAutoAssigned

    public void setAutoAssigned(boolean autoAssign)

  Whether this column is auto-incrementing.

### isRelationId

    public boolean isRelationId()

  Whether this column stores some form of serialized identity value for a related record. This makes the column dependent on the knowing the final identity of the relation before the column value is set.

### setRelationId

    public void setRelationId(boolean rel)

  Whether this column stores some form of serialized identity value for a related record. This makes the column dependent on the knowing the final identity of the relation before the column value is set.

### getTarget

    public String getTarget()

  The name of the column this column joins to, if any. Used for mapping.

### setTarget

    public void setTarget(String target)

  The name of the column this column joins to, if any. Used for mapping.

### getTargetField

    public String getTargetField()

  The name of the field this column joins to, if any. Used for mapping.

### setTargetField

    public void setTargetField(String target)

  The name of the field this column joins to, if any. Used for mapping.

### getFlag

    public boolean getFlag(int flag)

  Flags are used for bookkeeping information. They are ignored at runtime.

### setFlag

    public void setFlag(int flag,
                        boolean on)

  Flags are used for bookkeeping information. They are ignored at runtime.

### isPrimaryKey

    public boolean isPrimaryKey()

  Return true if this column belongs to the table's primary key.

### getIndex

    public int getIndex()

  Return the column's 0-based index in the owning table.

### isLob

    public boolean isLob()

  Whether this column is a LOB.

### isCompatible

    public boolean isCompatible(int type,
                                int size)

  Return true if this column is compatible with the given JDBC type from `Types` and size.

### toString

    public String toString()

  Returns the column name.

  Overrides:
    `toString` in class `Object`

### getDescription

    public String getDescription()

  Useful for debugging.

### equalsColumn

    public boolean equalsColumn(Column col)

  Tests compatibility.

### copy

    public void copy(Column from)

  Copy information from the given column to this one.

### getRefCount

    public int getRefCount()

### ref

    public void ref()

### deref

    public void deref()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 Apache Software Foundation. All Rights Reserved.