Top Description Inners Fields Constructors Methods
org.hibernate.id

public Class SequenceIdentityGenerator

extends SequenceGenerator
implements PostInsertIdentifierGenerator
Class Inheritance
All Implemented Interfaces
org.hibernate.id.PostInsertIdentifierGenerator, org.hibernate.id.IdentifierGenerator, org.hibernate.boot.model.relational.ExportableProducer, org.hibernate.id.Configurable
Annotations
@Deprecated
Imports
java.io.Serializable, java.sql.PreparedStatement, .SQLException, java.util.Properties, org.hibernate.HibernateException, .MappingException, org.hibernate.boot.model.relational.QualifiedName, .SqlStringGenerationContext, org.hibernate.dialect.Dialect, org.hibernate.engine.spi.SharedSessionContractImplementor, org.hibernate.id.insert.AbstractReturningDelegate, .IdentifierGeneratingInsert, .InsertGeneratedIdentifierDelegate, org.hibernate.internal.CoreLogging, .CoreMessageLogger, org.hibernate.service.ServiceRegistry, org.hibernate.sql.Insert, org.hibernate.type.Type

Deprecated

See deprecation discussion on SequenceGenerator

A generator which combines sequence generation with immediate retrieval through JDBC3 getGeneratedKeys. In this respect it works much like ANSI-SQL IDENTITY generation.

This generator only known to work with newer Oracle drivers compiled for JDK 1.4 (JDBC3).

Note

Due to a bug in Oracle drivers, sql comments on these insert statements are completely disabled.

Author
Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class

Field Summary

Modifier and TypeField and Description
private static final CoreMessageLogger
Inherited from org.hibernate.id.SequenceGenerator:
PARAMETERSSEQUENCE

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
configure(Type
The id property type descriptor
type
,
Properties
param values, keyed by parameter name
params
,
ServiceRegistry
Access to service that may be needed.
serviceRegistry
)

Overrides org.hibernate.id.SequenceGenerator.configure.

Overrides default org.hibernate.id.IdentifierGenerator.configure.

Configure this instance, given the value of parameters specified by the user as <param> elements.
public Serializable
generate(SharedSessionContractImplementor
The session from which the request originates
s
,
Object
the entity or collection (idbag) for which the id is being generated
obj
)

Overrides org.hibernate.id.SequenceGenerator.generate.

Implements org.hibernate.id.IdentifierGenerator.generate.

Generate a new identifier.
public InsertGeneratedIdentifierDelegate
Inherited from org.hibernate.id.SequenceGenerator:
buildHolderdetermineBulkInsertionIdentifierGenerationSelectFragmentgenerateHoldergeneratorKeygetAllSqlForTestsgetIdentifierTypegetPhysicalSequenceNamegetSequenceNameinitializeregisterExportablessupportsBulkInsertionIdentifierGeneration

Field Detail

LOGback to summary
private static final CoreMessageLogger LOG

Hides org.hibernate.id.SequenceGenerator.LOG.

Constructor Detail

SequenceIdentityGeneratorback to summary
public SequenceIdentityGenerator()

Method Detail

configureback to summary
public void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException

Overrides org.hibernate.id.SequenceGenerator.configure.

Overrides default org.hibernate.id.IdentifierGenerator.configure.

Doc from org.hibernate.id.IdentifierGenerator.configure.

Configure this instance, given the value of parameters specified by the user as <param> elements.

This method is called just once, following instantiation, and before registerExportables(Database).

Parameters
type:Type

The id property type descriptor

params:Properties

param values, keyed by parameter name

serviceRegistry:ServiceRegistry

Access to service that may be needed.

Annotations
@Override
Exceptions
MappingException:
If configuration fails.
generateback to summary
public Serializable generate(SharedSessionContractImplementor s, Object obj)

Overrides org.hibernate.id.SequenceGenerator.generate.

Implements org.hibernate.id.IdentifierGenerator.generate.

Doc from org.hibernate.id.IdentifierGenerator.generate.

Generate a new identifier.

Parameters
s:SharedSessionContractImplementor

The session from which the request originates

obj:Object

the entity or collection (idbag) for which the id is being generated

Returns:Serializable

a new identifier

Annotations
@Override
getInsertGeneratedIdentifierDelegateback to summary
public InsertGeneratedIdentifierDelegate getInsertGeneratedIdentifierDelegate(PostInsertIdentityPersister persister, Dialect dialect, boolean isGetGeneratedKeysEnabled) throws HibernateException

Implements org.hibernate.id.PostInsertIdentifierGenerator.getInsertGeneratedIdentifierDelegate.

Annotations
@Override
org.hibernate.id back to summary

public Class SequenceIdentityGenerator.Delegate

extends AbstractReturningDelegate
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final String[]
private final QualifiedName

Constructor Summary

AccessConstructor and Description
public
Delegate(PostInsertIdentityPersister persister, QualifiedName physicalSequenceName)

Method Summary

Modifier and TypeMethod and Description
protected Serializable
protected PreparedStatement
public IdentifierGeneratingInsert
prepareIdentifierGeneratingInsert(SqlStringGenerationContext
A context to help generate SQL strings
context
)

Overrides default org.hibernate.id.insert.InsertGeneratedIdentifierDelegate.prepareIdentifierGeneratingInsert.

Build a org.hibernate.sql.Insert specific to the delegate's mode of handling generated key values.
Inherited from org.hibernate.id.insert.AbstractReturningDelegate:
getPersisterperformInsertreleaseStatement

Field Detail

keyColumnsback to summary
private final String[] keyColumns
physicalSequenceNameback to summary
private final QualifiedName physicalSequenceName

Constructor Detail

Delegateback to summary
public Delegate(PostInsertIdentityPersister persister, QualifiedName physicalSequenceName)

Method Detail

executeAndExtractback to summary
protected Serializable executeAndExtract(PreparedStatement insert, SharedSessionContractImplementor session) throws SQLException

Implements abstract org.hibernate.id.insert.AbstractReturningDelegate.executeAndExtract.

Annotations
@Override
prepareback to summary
protected PreparedStatement prepare(String insertSQL, SharedSessionContractImplementor session) throws SQLException

Implements abstract org.hibernate.id.insert.AbstractReturningDelegate.prepare.

Annotations
@Override
prepareIdentifierGeneratingInsertback to summary
public IdentifierGeneratingInsert prepareIdentifierGeneratingInsert(SqlStringGenerationContext context)

Overrides default org.hibernate.id.insert.InsertGeneratedIdentifierDelegate.prepareIdentifierGeneratingInsert.

Doc from org.hibernate.id.insert.InsertGeneratedIdentifierDelegate.prepareIdentifierGeneratingInsert.

Build a org.hibernate.sql.Insert specific to the delegate's mode of handling generated key values.

Parameters
context:SqlStringGenerationContext

A context to help generate SQL strings

Returns:IdentifierGeneratingInsert

The insert object.

Annotations
@Override
org.hibernate.id back to summary

public Class SequenceIdentityGenerator.NoCommentsInsert

extends IdentifierGeneratingInsert
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Insert

Constructor Detail

NoCommentsInsertback to summary
public NoCommentsInsert(Dialect dialect)

Method Detail

setCommentback to summary
public Insert setComment(String comment)

Overrides org.hibernate.sql.Insert.setComment.

Annotations
@Override