HHH-12075 : SQLQuery.executeUpdate() ignores SQLQuery.setTimeout()

This commit is contained in:
Gail Badner 2018-01-08 22:47:07 -08:00
parent 489bdcd6fa
commit 712fb477e7
1 changed files with 5 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import java.sql.SQLException;
import org.hibernate.HibernateException;
import org.hibernate.action.internal.BulkOperationCleanupAction;
import org.hibernate.engine.spi.QueryParameters;
import org.hibernate.engine.spi.RowSelection;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.internal.CoreLogging;
@ -83,6 +84,7 @@ public class NativeSQLQueryPlan implements Serializable {
int result = 0;
PreparedStatement ps;
RowSelection selection = queryParameters.getRowSelection();
try {
queryParameters.processFilters( this.customQuery.getSQL(), session );
final String sql = session.getJdbcServices().getDialect()
@ -99,6 +101,9 @@ public class NativeSQLQueryPlan implements Serializable {
for ( ParameterBinder binder : this.customQuery.getParameterValueBinders() ) {
col += binder.bind( ps, queryParameters, session, col );
}
if ( selection != null && selection.getTimeout() != null ) {
ps.setQueryTimeout( selection.getTimeout() );
}
result = session.getJdbcCoordinator().getResultSetReturn().executeUpdate( ps );
}
finally {