|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hibernate.engine.TransactionHelper
org.hibernate.id.enhanced.TableGenerator
public class TableGenerator
An enhanced version of explicit table-based generator. The main basis
conceptualization is similiar to the legacy
MultipleHiLoPerTableGenerator
in terms of the
underlying storage structure (namely a single table capable of holding
multiple generator values). The differentiator is, as with
SequenceStyleGenerator
as well, the externalization of the notion
of an optimizer.
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 |
Field Summary | |
---|---|
static java.lang.String |
DEF_SEGMENT_COLUMN
|
static int |
DEF_SEGMENT_LENGTH
|
static java.lang.String |
DEF_SEGMENT_VALUE
|
static java.lang.String |
DEF_TABLE
|
static java.lang.String |
DEF_VALUE_COLUMN
|
static int |
DEFAULT_INCREMENT_SIZE
|
static int |
DEFAULT_INITIAL_VALUE
|
static java.lang.String |
INCREMENT_PARAM
|
static java.lang.String |
INITIAL_PARAM
|
static java.lang.String |
OPT_PARAM
|
static java.lang.String |
SEGMENT_COLUMN_PARAM
|
static java.lang.String |
SEGMENT_LENGTH_PARAM
|
static java.lang.String |
SEGMENT_VALUE_PARAM
|
static java.lang.String |
TABLE_PARAM
|
static java.lang.String |
VALUE_COLUMN_PARAM
|
Fields inherited from interface org.hibernate.id.PersistentIdentifierGenerator |
---|
CATALOG, PK, SCHEMA, SQL_STATEMENT_LOGGER, TABLE, TABLES |
Fields inherited from interface org.hibernate.id.IdentifierGenerator |
---|
ENTITY_NAME |
Constructor Summary | |
---|---|
TableGenerator()
|
Method Summary | |
---|---|
void |
configure(Type type,
java.util.Properties params,
Dialect dialect)
Configure this instance, given the value of parameters specified by the user as <param> elements. |
java.io.Serializable |
doWorkInCurrentTransaction(java.sql.Connection conn,
java.lang.String sql)
The work to be done |
java.io.Serializable |
generate(SessionImplementor session,
java.lang.Object obj)
Generate a new identifier. |
java.lang.Object |
generatorKey()
Return a key unique to the underlying database objects. |
Type |
getIdentifierType()
|
int |
getIncrementSize()
|
int |
getInitialValue()
|
Optimizer |
getOptimizer()
|
java.lang.String |
getSegmentColumnName()
|
java.lang.String |
getSegmentValue()
|
int |
getSegmentValueLength()
|
long |
getTableAccessCount()
|
java.lang.String |
getTableName()
|
java.lang.String |
getValueColumnName()
|
java.lang.String[] |
sqlCreateStrings(Dialect dialect)
The SQL required to create the underlying database objects. |
java.lang.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 |
---|
public static final java.lang.String TABLE_PARAM
public static final java.lang.String DEF_TABLE
public static final java.lang.String VALUE_COLUMN_PARAM
public static final java.lang.String DEF_VALUE_COLUMN
public static final java.lang.String SEGMENT_COLUMN_PARAM
public static final java.lang.String DEF_SEGMENT_COLUMN
public static final java.lang.String SEGMENT_VALUE_PARAM
public static final java.lang.String DEF_SEGMENT_VALUE
public static final java.lang.String SEGMENT_LENGTH_PARAM
public static final int DEF_SEGMENT_LENGTH
public static final java.lang.String INITIAL_PARAM
public static final int DEFAULT_INITIAL_VALUE
public static final java.lang.String INCREMENT_PARAM
public static final int DEFAULT_INCREMENT_SIZE
public static final java.lang.String OPT_PARAM
Constructor Detail |
---|
public TableGenerator()
Method Detail |
---|
public java.lang.String getTableName()
public java.lang.String getSegmentColumnName()
public java.lang.String getSegmentValue()
public int getSegmentValueLength()
public java.lang.String getValueColumnName()
public Type getIdentifierType()
public int getInitialValue()
public int getIncrementSize()
public Optimizer getOptimizer()
public long getTableAccessCount()
public void configure(Type type, java.util.Properties params, Dialect dialect) throws MappingException
Configurable
configure
in interface Configurable
params
- param values, keyed by parameter name
MappingException
public java.io.Serializable generate(SessionImplementor session, java.lang.Object obj)
IdentifierGenerator
generate
in interface IdentifierGenerator
obj
- the entity or toplevel collection for which the id is being generated
public java.io.Serializable doWorkInCurrentTransaction(java.sql.Connection conn, java.lang.String sql) throws java.sql.SQLException
TransactionHelper
doWorkInCurrentTransaction
in class TransactionHelper
java.sql.SQLException
public java.lang.String[] sqlCreateStrings(Dialect dialect) throws HibernateException
PersistentIdentifierGenerator
sqlCreateStrings
in interface PersistentIdentifierGenerator
dialect
- The dialect against which to generate the create command(s)
HibernateException
- problem creating the create command(s)public java.lang.String[] sqlDropStrings(Dialect dialect) throws HibernateException
PersistentIdentifierGenerator
sqlDropStrings
in interface PersistentIdentifierGenerator
dialect
- The dialect against which to generate the drop command(s)
HibernateException
- problem creating the drop command(s)public java.lang.Object generatorKey()
PersistentIdentifierGenerator
generatorKey
in interface PersistentIdentifierGenerator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |