Package org.hibernate.id.insert
Class AbstractSelectingDelegate
java.lang.Object
org.hibernate.id.insert.AbstractSelectingDelegate
- All Implemented Interfaces:
InsertGeneratedIdentifierDelegate
- Direct Known Subclasses:
IdentityGenerator.BasicDelegate,SelectGenerator.SelectGeneratorDelegate
public abstract class AbstractSelectingDelegate
extends Object
implements InsertGeneratedIdentifierDelegate
Abstract InsertGeneratedIdentifierDelegate implementation where the
underlying strategy requires an subsequent select after the insert
to determine the generated identifier.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbindParameters(SessionImplementor session, PreparedStatement ps, Object entity) Bind any required parameter values into the SQL commandgetSelectSQL().protected abstract SerializablegetResult(SessionImplementor session, ResultSet rs, Object entity) Extract the generated key value from the given result set.protected abstract StringGet the SQL statement to be used to retrieve generated key values.final SerializableperformInsert(String insertSQL, SessionImplementor session, Binder binder) Perform the indicated insert SQL statement and determine the identifier value generated.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.id.insert.InsertGeneratedIdentifierDelegate
prepareIdentifierGeneratingInsert
-
Constructor Details
-
AbstractSelectingDelegate
-
-
Method Details
-
performInsert
public final Serializable performInsert(String insertSQL, SessionImplementor session, Binder binder) Description copied from interface:InsertGeneratedIdentifierDelegatePerform the indicated insert SQL statement and determine the identifier value generated.- Specified by:
performInsertin interfaceInsertGeneratedIdentifierDelegate- Parameters:
insertSQL- The INSERT statement stringsession- The session in which we are operatingbinder- The param binder- Returns:
- The generated identifier value.
-
getSelectSQL
Get the SQL statement to be used to retrieve generated key values.- Returns:
- The SQL command string
-
bindParameters
protected void bindParameters(SessionImplementor session, PreparedStatement ps, Object entity) throws SQLException Bind any required parameter values into the SQL commandgetSelectSQL().- Parameters:
session- The sessionps- The preparedSQLcommandentity- The entity being saved.- Throws:
SQLException
-
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 sessionrs- The result set containing the generated primay key values.entity- The entity being saved.- Returns:
- The generated identifier
- Throws:
SQLException
-