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 java.lang.Object implements InsertGeneratedIdentifierDelegate
Abstract InsertGeneratedIdentifierDelegate implementation where the underlying strategy requires a subsequent select after the insert to determine the generated identifier.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSelectingDelegate(PostInsertIdentityPersister persister)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidbindParameters(SharedSessionContractImplementor session, java.sql.PreparedStatement ps, java.lang.Object entity)Bind any required parameter values into the SQL commandgetSelectSQL().protected abstract java.io.SerializablegetResult(SharedSessionContractImplementor session, java.sql.ResultSet rs, java.lang.Object entity)Extract the generated key value from the given result set.protected abstract java.lang.StringgetSelectSQL()Get the SQL statement to be used to retrieve generated key values.java.io.SerializableperformInsert(java.lang.String insertSQL, SharedSessionContractImplementor 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, wait
-
Methods inherited from interface org.hibernate.id.insert.InsertGeneratedIdentifierDelegate
prepareIdentifierGeneratingInsert, prepareIdentifierGeneratingInsert
-
-
-
-
Constructor Detail
-
AbstractSelectingDelegate
protected AbstractSelectingDelegate(PostInsertIdentityPersister persister)
-
-
Method Detail
-
performInsert
public final java.io.Serializable performInsert(java.lang.String insertSQL, SharedSessionContractImplementor 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
protected abstract java.lang.String getSelectSQL()
Get the SQL statement to be used to retrieve generated key values.- Returns:
- The SQL command string
-
bindParameters
protected void bindParameters(SharedSessionContractImplementor session, java.sql.PreparedStatement ps, java.lang.Object entity) throws java.sql.SQLException
Bind any required parameter values into the SQL commandgetSelectSQL().- Parameters:
session- The sessionps- The preparedSQLcommandentity- The entity being saved.- Throws:
java.sql.SQLException
-
getResult
protected abstract java.io.Serializable getResult(SharedSessionContractImplementor session, java.sql.ResultSet rs, java.lang.Object entity) throws java.sql.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:
java.sql.SQLException
-
-