HHH-15352 add ScrollableResults.setFetchSize()
This commit is contained in:
parent
f1ca6d9e5e
commit
6404704311
|
@ -135,4 +135,16 @@ public interface ScrollableResults<R> extends AutoCloseable, Closeable {
|
|||
* @return true if there is a row at that row number
|
||||
*/
|
||||
boolean setRowNumber(int rowNumber);
|
||||
|
||||
/**
|
||||
* Gives the JDBC driver a hint as to the number of rows that
|
||||
* should be fetched from the database when more rows are needed.
|
||||
* If {@code 0}, the JDBC driver's default setting will be used.
|
||||
*
|
||||
* @see java.sql.ResultSet#setFetchSize(int)
|
||||
* @see org.hibernate.cfg.AvailableSettings#STATEMENT_FETCH_SIZE
|
||||
*
|
||||
* @since 6.1.1
|
||||
*/
|
||||
void setFetchSize(int fetchSize);
|
||||
}
|
||||
|
|
|
@ -945,8 +945,9 @@ public interface AvailableSettings {
|
|||
* from the database when more rows are needed. If {@code 0}, the JDBC driver's
|
||||
* default settings will be used.
|
||||
*
|
||||
* @see java.sql.ResultSet#setFetchSize(int)
|
||||
* @see java.sql.PreparedStatement#setFetchSize(int)
|
||||
* @see org.hibernate.boot.SessionFactoryBuilder#applyJdbcFetchSize(int)
|
||||
* @see org.hibernate.ScrollableResults#setFetchSize(int)
|
||||
*/
|
||||
String STATEMENT_FETCH_SIZE = "hibernate.jdbc.fetch_size";
|
||||
|
||||
|
|
|
@ -85,6 +85,11 @@ public abstract class AbstractScrollableResults<R> implements ScrollableResultsI
|
|||
getPersistenceContext().afterScrollOperation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFetchSize(int fetchSize) {
|
||||
getJdbcValues().setFetchSize(fetchSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void close() {
|
||||
if ( this.closed ) {
|
||||
|
|
|
@ -91,6 +91,9 @@ public class EmptyScrollableResults implements ScrollableResultsImplementor {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFetchSize(int fetchSize) {}
|
||||
|
||||
@Override
|
||||
public Object[] get() {
|
||||
return ArrayHelper.EMPTY_OBJECT_ARRAY;
|
||||
|
|
|
@ -227,4 +227,7 @@ public class JdbcValuesCacheHit extends AbstractJdbcValues {
|
|||
protected void release() {
|
||||
cachedData = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFetchSize(int fetchSize) {}
|
||||
}
|
||||
|
|
|
@ -324,4 +324,14 @@ public class JdbcValuesResultSetImpl extends AbstractJdbcValues {
|
|||
public Object[] getCurrentRowValuesArray() {
|
||||
return currentRowJdbcValues;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFetchSize(int fetchSize) {
|
||||
try {
|
||||
resultSetAccess.getResultSet().setFetchSize(fetchSize);
|
||||
}
|
||||
catch (SQLException e) {
|
||||
throw makeExecutionException( "Error calling ResultSet.setFetchSize()", e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,4 +78,6 @@ public interface JdbcValues {
|
|||
* Give implementations a chance to finish processing
|
||||
*/
|
||||
void finishUp(SharedSessionContractImplementor session);
|
||||
|
||||
void setFetchSize(int fetchSize);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue