org.hibernate.id.insert

Class AbstractSelectingDelegate

Implemented Interfaces:
InsertGeneratedIdentifierDelegate
Known Direct Subclasses:
IdentityGenerator.BasicDelegate, SelectGenerator.SelectGeneratorDelegate

public abstract class AbstractSelectingDelegate
extends java.lang.Object
implements InsertGeneratedIdentifierDelegate

Abstract InsertGeneratedIdentifierDelegate implementation where the underlying strategy requires an subsequent select after the insert to determine the generated identifier.
Author:
Steve Ebersole

Constructor Summary

AbstractSelectingDelegate(PostInsertIdentityPersister persister)

Method Summary

protected void
bindParameters(SessionImplementor session, PreparedStatement ps, Object entity)
Bind any required parameter values into the SQL command getSelectSQL().
protected abstract Serializable
getResult(SessionImplementor session, ResultSet rs, Object entity)
Extract the generated key value from the given result set.
protected abstract String
getSelectSQL()
Get the SQL statement to be used to retrieve generated key values.
Serializable
performInsert(String insertSQL, SessionImplementor session, Binder binder)

Constructor Details

AbstractSelectingDelegate

protected AbstractSelectingDelegate(PostInsertIdentityPersister persister)

Method Details

bindParameters

protected void bindParameters(SessionImplementor session,
                              PreparedStatement ps,
                              Object entity)
            throws SQLException
Bind any required parameter values into the SQL command getSelectSQL().
Parameters:
session - The session
ps - The prepared SQL command
entity - The entity being saved.

getResult

protected abstract Serializable getResult(SessionImplementor session,
                                          ResultSet rs,
                                          Object entity)
            throws SQLException
Extract the generated key value from the given result set.
Parameters:
session - The session
rs - The result set containing the generated primay key values.
entity - The entity being saved.
Returns:
The generated identifier

getSelectSQL

protected abstract String getSelectSQL()
Get the SQL statement to be used to retrieve generated key values.
Returns:
The SQL command string

performInsert

public final Serializable performInsert(String insertSQL,
                                        SessionImplementor session,
                                        Binder binder)
Specified by:
performInsert in interface InsertGeneratedIdentifierDelegate