Top Description Inners Constructors Methods
org.hibernate.id

public Class IdentityGenerator

extends AbstractPostInsertGenerator
Class Inheritance
Imports
java.io.Serializable, java.sql.ResultSet, .SQLException, .PreparedStatement, org.hibernate.engine.SessionImplementor, org.hibernate.id.insert.InsertGeneratedIdentifierDelegate, .IdentifierGeneratingInsert, .AbstractSelectingDelegate, .AbstractReturningDelegate, .InsertSelectIdentityInsert, org.hibernate.dialect.Dialect, org.hibernate.HibernateException, .AssertionFailure

A generator for use with ANSI-SQL IDENTITY columns used as the primary key. The IdentityGenerator for autoincrement/identity key generation.

Indicates to the Session that identity (ie. identity/autoincrement column) key generation should be used.
Author
Christoph Sturm

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
IdentityGenerator.BasicDelegate

Delegate for dealing with IDENTITY columns where the dialect requires an additional command execution to retrieve the generated IDENTITY value

public static class
IdentityGenerator.GetGeneratedKeysDelegate

Delegate for dealing with IDENTITY columns using JDBC3 getGeneratedKeys

public static class
IdentityGenerator.InsertSelectDelegate

Delegate for dealing with IDENTITY columns where the dialect supports returning the generated IDENTITY value directly from the insert statement.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public InsertGeneratedIdentifierDelegate
Inherited from org.hibernate.id.AbstractPostInsertGenerator:
generate

Constructor Detail

IdentityGeneratorback to summary
public IdentityGenerator()

Method Detail

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 IdentityGenerator.BasicDelegate

extends AbstractSelectingDelegate
implements InsertGeneratedIdentifierDelegate
Class Inheritance
All Implemented Interfaces
org.hibernate.id.insert.InsertGeneratedIdentifierDelegate

Delegate for dealing with IDENTITY columns where the dialect requires an additional command execution to retrieve the generated IDENTITY value

Field Summary

Modifier and TypeField and Description
private final Dialect
private final PostInsertIdentityPersister

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected Serializable
getResult(SessionImplementor
The session
session
,
ResultSet
The result set containing the generated primay key values.
rs
,
Object
The entity being saved.
object
)

Implements abstract org.hibernate.id.insert.AbstractSelectingDelegate.getResult.

Extract the generated key value from the given result set.
protected String
getSelectSQL()

Implements abstract org.hibernate.id.insert.AbstractSelectingDelegate.getSelectSQL.

Get the SQL statement to be used to retrieve generated key values.
public IdentifierGeneratingInsert
Inherited from org.hibernate.id.insert.AbstractSelectingDelegate:
bindParametersperformInsert

Field Detail

dialectback to summary
private final Dialect dialect
persisterback to summary
private final PostInsertIdentityPersister persister

Hides org.hibernate.id.insert.AbstractSelectingDelegate.persister.

Constructor Detail

BasicDelegateback to summary
public BasicDelegate(PostInsertIdentityPersister persister, Dialect dialect)

Method Detail

getResultback to summary
protected Serializable getResult(SessionImplementor session, ResultSet rs, Object object) throws SQLException

Implements abstract org.hibernate.id.insert.AbstractSelectingDelegate.getResult.

Doc from org.hibernate.id.insert.AbstractSelectingDelegate.getResult.

Extract the generated key value from the given result set.

Parameters
session:SessionImplementor

The session

rs:ResultSet

The result set containing the generated primay key values.

object:Object

The entity being saved.

Returns:Serializable

The generated identifier

getSelectSQLback to summary
protected String getSelectSQL()

Implements abstract org.hibernate.id.insert.AbstractSelectingDelegate.getSelectSQL.

Doc from org.hibernate.id.insert.AbstractSelectingDelegate.getSelectSQL.

Get the SQL statement to be used to retrieve generated key values.

Returns:String

The SQL command string

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 IdentityGenerator.GetGeneratedKeysDelegate

extends AbstractReturningDelegate
implements InsertGeneratedIdentifierDelegate
Class Inheritance
All Implemented Interfaces
org.hibernate.id.insert.InsertGeneratedIdentifierDelegate

Delegate for dealing with IDENTITY columns using JDBC3 getGeneratedKeys

Field Summary

Modifier and TypeField and Description
private final Dialect
private final PostInsertIdentityPersister

Constructor Summary

AccessConstructor and Description
public

Method Summary

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

Field Detail

dialectback to summary
private final Dialect dialect
persisterback to summary
private final PostInsertIdentityPersister persister

Hides org.hibernate.id.insert.AbstractReturningDelegate.persister.

Constructor Detail

GetGeneratedKeysDelegateback to summary
public GetGeneratedKeysDelegate(PostInsertIdentityPersister persister, Dialect dialect)

Method Detail

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

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

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 IdentityGenerator.InsertSelectDelegate

extends AbstractReturningDelegate
implements InsertGeneratedIdentifierDelegate
Class Inheritance
All Implemented Interfaces
org.hibernate.id.insert.InsertGeneratedIdentifierDelegate

Delegate for dealing with IDENTITY columns where the dialect supports returning the generated IDENTITY value directly from the insert statement.

Field Summary

Modifier and TypeField and Description
private final Dialect
private final PostInsertIdentityPersister

Constructor Summary

AccessConstructor and Description
public

Method Summary

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

Field Detail

dialectback to summary
private final Dialect dialect
persisterback to summary
private final PostInsertIdentityPersister persister

Hides org.hibernate.id.insert.AbstractReturningDelegate.persister.

Constructor Detail

InsertSelectDelegateback to summary
public InsertSelectDelegate(PostInsertIdentityPersister persister, Dialect dialect)

Method Detail

determineGeneratedIdentifierback to summary
public Serializable determineGeneratedIdentifier(SessionImplementor session, Object entity)
executeAndExtractback to summary
public Serializable executeAndExtract(PreparedStatement insert) throws SQLException

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

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.