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.hibernate.id.enhanced
Class TableGenerator

    java.lang.Object
      org.hibernate.engine.TransactionHelper
          org.hibernate.id.enhanced.TableGenerator

All Implemented Interfaces:
  Configurable, IdentifierGenerator, PersistentIdentifierGenerator

    public class TableGenerator

extends TransactionHelper
implements PersistentIdentifierGenerator, Configurable

A "segmented" version of the enhanced table generator. The term "segmented" refers to the fact that this table can hold multiple value generators, segmented by a key.

Configuration parameters:

NAME | DEFAULT | DESCRIPTION
`TABLE_PARAM` | `DEF_TABLE` | The name of the table to use to store/retrieve values
`VALUE_COLUMN_PARAM` | `DEF_VALUE_COLUMN` | The name of column which holds the sequence value for the given segment
`SEGMENT_COLUMN_PARAM` | `DEF_SEGMENT_COLUMN` | The name of the column which holds the segment key
`SEGMENT_VALUE_PARAM` | `DEF_SEGMENT_VALUE` | The value indicating which segment is used by this generator; refers to values in the `SEGMENT_COLUMN_PARAM` column
`SEGMENT_LENGTH_PARAM` | `DEF_SEGMENT_LENGTH` | The data length of the `SEGMENT_COLUMN_PARAM` column; used for schema creation
`INITIAL_PARAM` | `DEFAULT_INITIAL_VALUE` | The initial value to be stored for the given segment
`INCREMENT_PARAM` | `DEFAULT_INCREMENT_SIZE` | The increment size for the underlying segment; see the discussion on `Optimizer` for more details.
`OPT_PARAM` | depends on defined increment size | Allows explicit definition of which optimization strategy to use

Author:
  Steve Ebersole

Field Summary
`static String` | `DEF_SEGMENT_COLUMN`
`static int` | `DEF_SEGMENT_LENGTH`
`static String` | `DEF_SEGMENT_VALUE`
`static String` | `DEF_TABLE`
`static String` | `DEF_VALUE_COLUMN`
`static int` | `DEFAULT_INCREMENT_SIZE`
`static int` | `DEFAULT_INITIAL_VALUE`
`static String` | `INCREMENT_PARAM`
`static String` | `INITIAL_PARAM`
`static String` | `OPT_PARAM`
`static String` | `SEGMENT_COLUMN_PARAM`
`static String` | `SEGMENT_LENGTH_PARAM`
`static String` | `SEGMENT_VALUE_PARAM`
`static String` | `TABLE_PARAM`
`static String` | `VALUE_COLUMN_PARAM`

Fields inherited from interface org.hibernate.id.PersistentIdentifierGenerator
`CATALOG, PK, SCHEMA, SQL, TABLE, TABLES`

Fields inherited from interface org.hibernate.id.IdentifierGenerator
`ENTITY_NAME`

Constructor Summary
`TableGenerator()`

Method Summary
`void` | `configure(Type type, Properties params, Dialect dialect)` Configure this instance, given the value of parameters specified by the user as `<param>` elements.
`Serializable` | `doWorkInCurrentTransaction(Connection conn, String sql)` The work to be done
`Serializable` | `generate(SessionImplementor session, Object obj)` Generate a new identifier.
`Object` | `generatorKey()` Return a key unique to the underlying database objects.
`Type` | `getIdentifierType()`
`int` | `getIncrementSize()`
`int` | `getInitialValue()`
`Optimizer` | `getOptimizer()`
`String` | `getSegmentColumnName()`
`String` | `getSegmentValue()`
`int` | `getSegmentValueLength()`
`long` | `getTableAccessCount()`
`String` | `getTableName()`
`String` | `getValueColumnName()`
`String[]` | `sqlCreateStrings(Dialect dialect)` The SQL required to create the underlying database objects.
`String[]` | `sqlDropStrings(Dialect dialect)` The SQL required to remove the underlying database objects.

Methods inherited from class org.hibernate.engine.TransactionHelper
`doWorkInNewTransaction`

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

Field Detail

### TABLE_PARAM

    public static final String TABLE_PARAM

See Also:
  Constant Field Values

### DEF_TABLE

    public static final String DEF_TABLE

See Also:
  Constant Field Values

### VALUE_COLUMN_PARAM

    public static final String VALUE_COLUMN_PARAM

See Also:
  Constant Field Values

### DEF_VALUE_COLUMN

    public static final String DEF_VALUE_COLUMN

See Also:
  Constant Field Values

### SEGMENT_COLUMN_PARAM

    public static final String SEGMENT_COLUMN_PARAM

See Also:
  Constant Field Values

### DEF_SEGMENT_COLUMN

    public static final String DEF_SEGMENT_COLUMN

See Also:
  Constant Field Values

### SEGMENT_VALUE_PARAM

    public static final String SEGMENT_VALUE_PARAM

See Also:
  Constant Field Values

### DEF_SEGMENT_VALUE

    public static final String DEF_SEGMENT_VALUE

See Also:
  Constant Field Values

### SEGMENT_LENGTH_PARAM

    public static final String SEGMENT_LENGTH_PARAM

See Also:
  Constant Field Values

### DEF_SEGMENT_LENGTH

    public static final int DEF_SEGMENT_LENGTH

See Also:
  Constant Field Values

### INITIAL_PARAM

    public static final String INITIAL_PARAM

See Also:
  Constant Field Values

### DEFAULT_INITIAL_VALUE

    public static final int DEFAULT_INITIAL_VALUE

See Also:
  Constant Field Values

### INCREMENT_PARAM

    public static final String INCREMENT_PARAM

See Also:
  Constant Field Values

### DEFAULT_INCREMENT_SIZE

    public static final int DEFAULT_INCREMENT_SIZE

See Also:
  Constant Field Values

### OPT_PARAM

    public static final String OPT_PARAM

See Also:
  Constant Field Values

Constructor Detail

### TableGenerator

    public TableGenerator()

Method Detail

### getTableName

    public String getTableName()

### getSegmentColumnName

    public String getSegmentColumnName()

### getSegmentValue

    public String getSegmentValue()

### getSegmentValueLength

    public int getSegmentValueLength()

### getValueColumnName

    public String getValueColumnName()

### getIdentifierType

    public Type getIdentifierType()

### getInitialValue

    public int getInitialValue()

### getIncrementSize

    public int getIncrementSize()

### getOptimizer

    public Optimizer getOptimizer()

### getTableAccessCount

    public long getTableAccessCount()

### configure

    public void configure(Type type,
                          Properties params,
                          Dialect dialect)
                   throws MappingException

  Description copied from interface: `Configurable`
  Configure this instance, given the value of parameters specified by the user as `<param>` elements. This method is called just once, following instantiation.

  Specified by:
    `configure` in interface `Configurable`
    `params` - param values, keyed by parameter name
  Throws:
    `MappingException`

### generate

    public Serializable generate(SessionImplementor session,
                                 Object obj)

  Description copied from interface: `IdentifierGenerator`
  Generate a new identifier.

  Specified by:
    `generate` in interface `IdentifierGenerator`
    `obj` - the entity or toplevel collection for which the id is being generated
  Returns:
    a new identifier

### doWorkInCurrentTransaction

    public Serializable doWorkInCurrentTransaction(Connection conn,
                                                   String sql)
                                            throws SQLException

  Description copied from class: `TransactionHelper`
  The work to be done

  Specified by:
    `doWorkInCurrentTransaction` in class `TransactionHelper`
  Throws:
    `SQLException`

### sqlCreateStrings

    public String[] sqlCreateStrings(Dialect dialect)
                              throws HibernateException

  Description copied from interface: `PersistentIdentifierGenerator`
  The SQL required to create the underlying database objects.

  Specified by:
    `sqlCreateStrings` in interface `PersistentIdentifierGenerator`
  Returns:
    String[]
  Throws:
    `HibernateException`

### sqlDropStrings

    public String[] sqlDropStrings(Dialect dialect)
                            throws HibernateException

  Description copied from interface: `PersistentIdentifierGenerator`
  The SQL required to remove the underlying database objects.

  Specified by:
    `sqlDropStrings` in interface `PersistentIdentifierGenerator`
  Returns:
    String
  Throws:
    `HibernateException`

### generatorKey

    public Object generatorKey()

  Description copied from interface: `PersistentIdentifierGenerator`
  Return a key unique to the underlying database objects. Prevents us from trying to create/remove them multiple times.

  Specified by:
    `generatorKey` in interface `PersistentIdentifierGenerator`
  Returns:
    Object an identifying key for this generator

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