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
Imports
org.hibernate.id.insert.InsertGeneratedIdentifierDelegate, .AbstractReturningDelegate, .IdentifierGeneratingInsert, org.hibernate.dialect.Dialect, org.hibernate.HibernateException, .MappingException, org.hibernate.sql.Insert, org.hibernate.type.Type, org.hibernate.engine.SessionImplementor, org.slf4j.Logger, .LoggerFactory, java.io.Serializable, java.sql.PreparedStatement, .SQLException, java.util.Properties

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 Logger
Inherited from org.hibernate.id.SequenceGenerator:
PARAMETERSSEQUENCE

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
configure(Type type, Properties
param values, keyed by parameter name
params
,
Dialect dialect)

Overrides org.hibernate.id.SequenceGenerator.configure.

Implements org.hibernate.id.Configurable.configure.

Configure this instance, given the value of parameters specified by the user as <param> elements.
public Serializable
generate(SessionImplementor s, Object
the entity or toplevel collection 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:
buildHoldergenerateHoldergeneratorKeygetIdentifierTypegetSequenceNamesqlCreateStringssqlDropStrings

Field Detail

logback to summary
private static final Logger 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, Dialect dialect) throws MappingException

Overrides org.hibernate.id.SequenceGenerator.configure.

Implements org.hibernate.id.Configurable.configure.

Doc from org.hibernate.id.Configurable.configure.

Configure this instance, given the value of parameters specified by the user as <param> elements. This method is called just once, following instantiation.

Parameters
params:Properties

param values, keyed by parameter name

generateback to summary
public Serializable generate(SessionImplementor 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
obj:Object

the entity or toplevel collection for which the id is being generated

Returns:Serializable

a new identifier

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

Implements org.hibernate.id.PostInsertIdentifierGenerator.getInsertGeneratedIdentifierDelegate.

org.hibernate.id back to summary

public Class SequenceIdentityGenerator.Delegate

extends AbstractReturningDelegate
Class Inheritance

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
Delegate(PostInsertIdentityPersister persister, Dialect dialect, String sequenceName)

Method Summary

Modifier and TypeMethod and Description
protected Serializable
protected PreparedStatement
public IdentifierGeneratingInsert
Inherited from org.hibernate.id.insert.AbstractReturningDelegate:
getPersisterperformInsertreleaseStatement

Field Detail

dialectback to summary
private final Dialect dialect
keyColumnsback to summary
private final String[] keyColumns
sequenceNextValFragmentback to summary
private final String sequenceNextValFragment

Constructor Detail

Delegateback to summary
public Delegate(PostInsertIdentityPersister persister, Dialect dialect, String sequenceName)

Method Detail

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

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

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

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

prepareIdentifierGeneratingInsertback to summary
public IdentifierGeneratingInsert prepareIdentifierGeneratingInsert()

Implements 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.

Returns:IdentifierGeneratingInsert

The insert object.

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.