|
||||||||||
| 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.TableGenerator
public class TableGenerator
An IdentifierGenerator that uses a database
table to store the last generated value. It is not
intended that applications use this strategy directly.
However, it may be used to build other (efficient)
strategies. The returned type is any supported by
IntegralDataTypeHolder
session
transaction so the generator must be able to obtain a new
connection and commit it. Hence this implementation may only
be used when Hibernate is fetching connections, not when the
user is supplying connections.
Again, the return types supported here are any of the ones
supported by IntegralDataTypeHolder. This is new
as of 3.5. Prior to that this generator only returned Integer
values.
Mapping parameters supported: table, column
TableHiLoGenerator| Field Summary | |
|---|---|
static java.lang.String |
COLUMN
The column parameter |
static java.lang.String |
DEFAULT_COLUMN_NAME
Default column name |
static java.lang.String |
DEFAULT_TABLE_NAME
Default table name |
static java.lang.String |
TABLE
The table parameter |
| Fields inherited from interface org.hibernate.id.PersistentIdentifierGenerator |
|---|
CATALOG, IDENTIFIER_NORMALIZER, PK, SCHEMA, SQL_STATEMENT_LOGGER, TABLES |
| Fields inherited from interface org.hibernate.id.IdentifierGenerator |
|---|
ENTITY_NAME |
| Constructor Summary | |
|---|---|
TableGenerator()
|
|
| Method Summary | |
|---|---|
protected IntegralDataTypeHolder |
buildHolder()
|
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)
Get the next value. |
java.io.Serializable |
generate(SessionImplementor session,
java.lang.Object object)
Generate a new identifier. |
protected IntegralDataTypeHolder |
generateHolder(SessionImplementor session)
|
java.lang.Object |
generatorKey()
Return a key unique to the underlying database objects. |
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 COLUMN
public static final java.lang.String DEFAULT_COLUMN_NAME
public static final java.lang.String TABLE
public static final java.lang.String DEFAULT_TABLE_NAME
| Constructor Detail |
|---|
public TableGenerator()
| Method Detail |
|---|
public void configure(Type type,
java.util.Properties params,
Dialect dialect)
Configurable
configure in interface Configurableparams - param values, keyed by parameter name
public java.io.Serializable generate(SessionImplementor session,
java.lang.Object object)
IdentifierGenerator
generate in interface IdentifierGeneratorobject - the entity or toplevel collection for which the id is being generated
protected IntegralDataTypeHolder generateHolder(SessionImplementor session)
public java.lang.String[] sqlCreateStrings(Dialect dialect)
throws HibernateException
PersistentIdentifierGenerator
sqlCreateStrings in interface PersistentIdentifierGeneratordialect - The dialect against which to generate the create command(s)
HibernateException - problem creating the create command(s)public java.lang.String[] sqlDropStrings(Dialect dialect)
PersistentIdentifierGenerator
sqlDropStrings in interface PersistentIdentifierGeneratordialect - The dialect against which to generate the drop command(s)
public java.lang.Object generatorKey()
PersistentIdentifierGenerator
generatorKey in interface PersistentIdentifierGenerator
public java.io.Serializable doWorkInCurrentTransaction(java.sql.Connection conn,
java.lang.String sql)
throws java.sql.SQLException
doWorkInCurrentTransaction in class TransactionHelperconn - The sql connection to use.sql - n/a
Integer. Since 3.5 it now
returns a IntegralDataTypeHolder
java.sql.SQLExceptionprotected IntegralDataTypeHolder buildHolder()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||