HHH-12075 : SQLQuery.executeUpdate() ignores SQLQuery.setTimeout()
(cherry picked from commit 712fb477e7
)
This commit is contained in:
parent
1ee2e9d1f5
commit
40bbc56063
|
@ -17,6 +17,7 @@ import org.hibernate.HibernateException;
|
||||||
import org.hibernate.QueryException;
|
import org.hibernate.QueryException;
|
||||||
import org.hibernate.action.internal.BulkOperationCleanupAction;
|
import org.hibernate.action.internal.BulkOperationCleanupAction;
|
||||||
import org.hibernate.engine.spi.QueryParameters;
|
import org.hibernate.engine.spi.QueryParameters;
|
||||||
|
import org.hibernate.engine.spi.RowSelection;
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
import org.hibernate.engine.spi.SessionImplementor;
|
||||||
import org.hibernate.engine.spi.TypedValue;
|
import org.hibernate.engine.spi.TypedValue;
|
||||||
import org.hibernate.event.spi.EventSource;
|
import org.hibernate.event.spi.EventSource;
|
||||||
|
@ -181,6 +182,7 @@ public class NativeSQLQueryPlan implements Serializable {
|
||||||
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
PreparedStatement ps;
|
PreparedStatement ps;
|
||||||
|
RowSelection selection = queryParameters.getRowSelection();
|
||||||
try {
|
try {
|
||||||
queryParameters.processFilters( this.customQuery.getSQL(), session );
|
queryParameters.processFilters( this.customQuery.getSQL(), session );
|
||||||
final String sql = queryParameters.getFilteredSQL();
|
final String sql = queryParameters.getFilteredSQL();
|
||||||
|
@ -191,6 +193,9 @@ public class NativeSQLQueryPlan implements Serializable {
|
||||||
int col = 1;
|
int col = 1;
|
||||||
col += bindPositionalParameters( ps, queryParameters, col, session );
|
col += bindPositionalParameters( ps, queryParameters, col, session );
|
||||||
col += bindNamedParameters( ps, queryParameters.getNamedParameters(), col, session );
|
col += bindNamedParameters( ps, queryParameters.getNamedParameters(), col, session );
|
||||||
|
if ( selection != null && selection.getTimeout() != null ) {
|
||||||
|
ps.setQueryTimeout( selection.getTimeout() );
|
||||||
|
}
|
||||||
result = session.getJdbcCoordinator().getResultSetReturn().executeUpdate( ps );
|
result = session.getJdbcCoordinator().getResultSetReturn().executeUpdate( ps );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|
Loading…
Reference in New Issue