FileDocCategorySizeDatePackage
AbstractReturningDelegate.javaAPI DocHibernate 3.2.52040Mon Mar 27 10:47:06 BST 2006org.hibernate.id.insert

AbstractReturningDelegate

public abstract class AbstractReturningDelegate extends Object implements InsertGeneratedIdentifierDelegate
Abstract InsertGeneratedIdentifierDelegate implementation where the underlying strategy causes the enerated identitifer to be returned as an effect of performing the insert statement. Thus, there is no need for an additional sql statement to determine the generated identitifer.
author
Steve Ebersole

Fields Summary
private final org.hibernate.id.PostInsertIdentityPersister
persister
Constructors Summary
public AbstractReturningDelegate(org.hibernate.id.PostInsertIdentityPersister persister)

		this.persister = persister;
	
Methods Summary
protected abstract java.io.SerializableexecuteAndExtract(java.sql.PreparedStatement insert)

protected org.hibernate.id.PostInsertIdentityPersistergetPersister()

		return persister;
	
public final java.io.SerializableperformInsert(java.lang.String insertSQL, org.hibernate.engine.SessionImplementor session, Binder binder)

		try {
			// prepare and execute the insert
			PreparedStatement insert = prepare( insertSQL, session );
			try {
				binder.bindValues( insert );
				return executeAndExtract( insert );
			}
			finally {
				releaseStatement( insert, session );
			}
		}
		catch ( SQLException sqle ) {
			throw JDBCExceptionHelper.convert(
					session.getFactory().getSQLExceptionConverter(),
			        sqle,
			        "could not insert: " + MessageHelper.infoString( persister ),
			        insertSQL
				);
		}
	
protected abstract java.sql.PreparedStatementprepare(java.lang.String insertSQL, org.hibernate.engine.SessionImplementor session)

protected voidreleaseStatement(java.sql.PreparedStatement insert, org.hibernate.engine.SessionImplementor session)

		session.getBatcher().closeStatement( insert );