HHH-8426 Add defaultScrollMode to Dialect

This commit is contained in:
Brett Meyer 2013-08-06 11:18:13 -04:00
parent 6c708e2180
commit a2da429997
4 changed files with 14 additions and 4 deletions

View File

@ -45,6 +45,7 @@ import org.hibernate.LockMode;
import org.hibernate.LockOptions;
import org.hibernate.MappingException;
import org.hibernate.NullPrecedence;
import org.hibernate.ScrollMode;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.CastFunction;
import org.hibernate.dialect.function.SQLFunction;
@ -2670,5 +2671,14 @@ public abstract class Dialect implements ConversionContext {
*/
public String getQueryHintString(String query, List<String> hints) {
return query;
}
}
/**
* Certain dialects support a subset of ScrollModes. Provide a default to be used by Criteria and Query.
*
* @return ScrollMode
*/
public ScrollMode defaultScrollMode() {
return ScrollMode.SCROLL_INSENSITIVE;
}
}

View File

@ -385,7 +385,7 @@ public class CriteriaImpl implements Criteria, Serializable {
}
@Override
public ScrollableResults scroll() {
return scroll( ScrollMode.SCROLL_INSENSITIVE );
return scroll( session.getFactory().getDialect().defaultScrollMode() );
}
@Override
public ScrollableResults scroll(ScrollMode scrollMode) {

View File

@ -76,7 +76,7 @@ public class QueryImpl extends AbstractQueryImpl {
}
public ScrollableResults scroll() throws HibernateException {
return scroll( ScrollMode.SCROLL_INSENSITIVE );
return scroll( session.getFactory().getDialect().defaultScrollMode() );
}
public ScrollableResults scroll(ScrollMode scrollMode) throws HibernateException {

View File

@ -171,7 +171,7 @@ public class SQLQueryImpl extends AbstractQueryImpl implements SQLQuery {
}
public ScrollableResults scroll() throws HibernateException {
return scroll(ScrollMode.SCROLL_INSENSITIVE);
return scroll( session.getFactory().getDialect().defaultScrollMode() );
}
public Iterator iterate() throws HibernateException {