HHH-9340 - Streams API for query result processing.

This commit is contained in:
Steve Ebersole 2016-05-13 08:38:06 -05:00
parent b990cf08ea
commit eb308a953a
17 changed files with 87 additions and 110 deletions

View File

@ -6,6 +6,7 @@
*/
package org.hibernate;
import org.hibernate.query.CommonQueryContract;
import org.hibernate.type.Type;
/**
@ -13,7 +14,7 @@ import org.hibernate.type.Type;
*
* @author Steve Ebersole
*
* @deprecated (since 5.2) use {@link org.hibernate.query.BasicQueryContract} instead.
* @deprecated (since 5.2) use {@link CommonQueryContract} instead.
*/
@Deprecated
public interface BasicQueryContract {
@ -29,9 +30,9 @@ public interface BasicQueryContract {
* @deprecated (since 5.2) use {@link #setHibernateFlushMode} instead
*/
@Deprecated
default org.hibernate.query.BasicQueryContract setFlushMode(FlushMode flushMode) {
default CommonQueryContract setFlushMode(FlushMode flushMode) {
setHibernateFlushMode( flushMode );
return (org.hibernate.query.BasicQueryContract) this;
return (CommonQueryContract) this;
}
/**
@ -54,7 +55,7 @@ public interface BasicQueryContract {
*
* @see #getHibernateFlushMode()
*/
org.hibernate.query.BasicQueryContract setHibernateFlushMode(FlushMode flushMode);
CommonQueryContract setHibernateFlushMode(FlushMode flushMode);
/**
* Obtain the CacheMode in effect for this query. By default, the query inherits the CacheMode of the Session
@ -79,7 +80,7 @@ public interface BasicQueryContract {
*
* @see #getCacheMode()
*/
org.hibernate.query.BasicQueryContract setCacheMode(CacheMode cacheMode);
CommonQueryContract setCacheMode(CacheMode cacheMode);
/**
* Are the results of this query eligible for second level query caching? This is different that second level
@ -104,7 +105,7 @@ public interface BasicQueryContract {
*
* @see #isCacheable
*/
org.hibernate.query.BasicQueryContract setCacheable(boolean cacheable);
CommonQueryContract setCacheable(boolean cacheable);
/**
* Obtain the name of the second level query cache region in which query results will be stored (if they are
@ -126,7 +127,7 @@ public interface BasicQueryContract {
*
* @see #getCacheRegion()
*/
org.hibernate.query.BasicQueryContract setCacheRegion(String cacheRegion);
CommonQueryContract setCacheRegion(String cacheRegion);
/**
* Obtain the query timeout <b>in seconds</b>. This value is eventually passed along to the JDBC query via
@ -151,7 +152,7 @@ public interface BasicQueryContract {
*
* @see #getTimeout()
*/
org.hibernate.query.BasicQueryContract setTimeout(int timeout);
CommonQueryContract setTimeout(int timeout);
/**
* Obtain the JDBC fetch size hint in effect for this query. This value is eventually passed along to the JDBC
@ -177,7 +178,7 @@ public interface BasicQueryContract {
*
* @see #getFetchSize()
*/
org.hibernate.query.BasicQueryContract setFetchSize(int fetchSize);
CommonQueryContract setFetchSize(int fetchSize);
/**
* Should entities and proxies loaded by this Query be put in read-only mode? If the
@ -223,7 +224,7 @@ public interface BasicQueryContract {
* are to be put in read-only mode; {@code false} indicates that entities and proxies
* loaded by the query will be put in modifiable mode
*/
org.hibernate.query.BasicQueryContract setReadOnly(boolean readOnly);
CommonQueryContract setReadOnly(boolean readOnly);
/**
* Return the Hibernate types of the query results.

View File

@ -18,7 +18,6 @@ import java.util.Set;
import org.hibernate.Filter;
import org.hibernate.HibernateException;
import org.hibernate.QueryException;
import org.hibernate.ScrollableResults;
import org.hibernate.engine.spi.QueryParameters;
import org.hibernate.engine.spi.RowSelection;
import org.hibernate.engine.spi.SessionFactoryImplementor;

View File

@ -19,7 +19,6 @@ import org.hibernate.FlushMode;
import org.hibernate.HibernateException;
import org.hibernate.Interceptor;
import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.SharedSessionContract;
import org.hibernate.Transaction;
import org.hibernate.collection.spi.PersistentCollection;
@ -33,7 +32,6 @@ import org.hibernate.query.spi.QueryProducerImplementor;
import org.hibernate.query.spi.ScrollableResultsImplementor;
import org.hibernate.resource.jdbc.spi.JdbcSessionOwner;
import org.hibernate.resource.transaction.spi.TransactionCoordinator;
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder.Options;
import org.hibernate.type.descriptor.WrapperOptions;
@ -52,7 +50,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
* {@link Options}
* to drive the creation of the {@link TransactionCoordinator} delegate.
* This allows it to be passed along to
* {@link TransactionCoordinatorBuilder#buildTransactionCoordinator}
* {@link org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder#buildTransactionCoordinator}
* </li>
* <li>
* {@link org.hibernate.engine.jdbc.LobCreationContext} to act as the context for JDBC LOB instance creation

View File

@ -18,7 +18,6 @@ import java.util.Set;
import org.hibernate.HibernateException;
import org.hibernate.MappingException;
import org.hibernate.QueryException;
import org.hibernate.ScrollableResults;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.engine.query.spi.EntityGraphQueryHint;
import org.hibernate.engine.spi.QueryParameters;

View File

@ -29,7 +29,6 @@ import org.hibernate.LockMode;
import org.hibernate.LockOptions;
import org.hibernate.MappingException;
import org.hibernate.QueryException;
import org.hibernate.ScrollableResults;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.internal.JoinSequence;
import org.hibernate.engine.spi.QueryParameters;

View File

@ -15,7 +15,6 @@ import java.util.Set;
import org.hibernate.HibernateException;
import org.hibernate.MappingException;
import org.hibernate.QueryException;
import org.hibernate.ScrollableResults;
import org.hibernate.engine.spi.QueryParameters;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.event.spi.EventSource;

View File

@ -26,7 +26,6 @@ import org.hibernate.HibernateException;
import org.hibernate.Interceptor;
import org.hibernate.LockMode;
import org.hibernate.MultiTenancyStrategy;
import org.hibernate.ScrollableResults;
import org.hibernate.SessionException;
import org.hibernate.Transaction;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;

View File

@ -21,7 +21,6 @@ import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.MappingException;
import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.SessionException;
import org.hibernate.StatelessSession;
import org.hibernate.UnresolvableObjectException;
@ -179,7 +178,7 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
@Override
public Object get(String entityName, Serializable id, LockMode lockMode) {
checkOpen();
Object result = getFactory().getEntityPersister( entityName )
Object result = getFactory().getMetamodel().entityPersister( entityName )
.load( id, null, lockMode, this );
if ( temporaryPersistenceContext.isLoadFinished() ) {
temporaryPersistenceContext.clear();
@ -254,7 +253,7 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
String entityName,
Serializable id) throws HibernateException {
checkOpen();
return getFactory().getEntityPersister( entityName ).instantiate( id, this );
return getFactory().getMetamodel().entityPersister( entityName ).instantiate( id, this );
}
@Override
@ -264,7 +263,7 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
boolean eager,
boolean nullable) throws HibernateException {
checkOpen();
EntityPersister persister = getFactory().getEntityPersister( entityName );
EntityPersister persister = getFactory().getMetamodel().entityPersister( entityName );
// first, try to load it from the temp PC associated to this SS
Object loaded = temporaryPersistenceContext.getEntity( generateEntityKey( id, persister ) );
if ( loaded != null ) {

View File

@ -28,7 +28,6 @@ import org.hibernate.LockMode;
import org.hibernate.LockOptions;
import org.hibernate.QueryException;
import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import org.hibernate.StaleObjectStateException;
import org.hibernate.WrongClassException;
@ -385,7 +384,7 @@ public abstract class Loader {
);
}
catch (SQLException sqle) {
throw factory.getSQLExceptionHelper().convert(
throw factory.getJdbcServices().getSqlExceptionHelper().convert(
sqle,
"could not read next row of results",
getSQLString()
@ -445,7 +444,7 @@ public abstract class Loader {
isCurrentRowForSameEntity( keyToRead, 0, resultSet, session ) );
}
catch (SQLException sqle) {
throw factory.getSQLExceptionHelper().convert(
throw factory.getJdbcServices().getSqlExceptionHelper().convert(
sqle,
"could not doAfterTransactionCompletion sequential read of results (forward)",
getSQLString()
@ -524,7 +523,7 @@ public abstract class Loader {
return sequentialLoad( resultSet, session, queryParameters, returnProxies, currentKey );
}
catch (SQLException sqle) {
throw factory.getSQLExceptionHelper().convert(
throw factory.getJdbcServices().getSqlExceptionHelper().convert(
sqle,
"could not perform sequential read of results (forward)",
getSQLString()
@ -651,7 +650,7 @@ public abstract class Loader {
return sequentialLoad( resultSet, session, queryParameters, returnProxies, keyToRead );
}
catch (SQLException sqle) {
throw factory.getSQLExceptionHelper().convert(
throw factory.getJdbcServices().getSqlExceptionHelper().convert(
sqle,
"could not doAfterTransactionCompletion sequential read of results (forward)",
getSQLString()
@ -939,7 +938,7 @@ public abstract class Loader {
);
}
finally {
session.getJdbcCoordinator().getResourceRegistry().release( st );
session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st );
session.getJdbcCoordinator().afterStatementExecution();
}
@ -1978,15 +1977,10 @@ public abstract class Loader {
LOG.tracev( "Bound [{0}] parameters total", col );
}
}
catch (SQLException sqle) {
session.getJdbcCoordinator().getResourceRegistry().release( st );
catch (SQLException | HibernateException e) {
session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st );
session.getJdbcCoordinator().afterStatementExecution();
throw sqle;
}
catch (HibernateException he) {
session.getJdbcCoordinator().getResourceRegistry().release( st );
session.getJdbcCoordinator().afterStatementExecution();
throw he;
throw e;
}
return st;
@ -2125,15 +2119,10 @@ public abstract class Loader {
}
return rs;
}
catch (SQLException sqle) {
session.getJdbcCoordinator().getResourceRegistry().release( st );
catch (SQLException | HibernateException e) {
session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st );
session.getJdbcCoordinator().afterStatementExecution();
throw sqle;
}
catch (HibernateException he) {
session.getJdbcCoordinator().getResourceRegistry().release( st );
session.getJdbcCoordinator().afterStatementExecution();
throw he;
throw e;
}
}
@ -2204,7 +2193,7 @@ public abstract class Loader {
}
catch (SQLException sqle) {
final Loadable[] persisters = getEntityPersisters();
throw factory.getSQLExceptionHelper().convert(
throw factory.getJdbcServices().getSqlExceptionHelper().convert(
sqle,
"could not load an entity: " +
MessageHelper.infoString(
@ -2249,7 +2238,7 @@ public abstract class Loader {
);
}
catch (SQLException sqle) {
throw factory.getSQLExceptionHelper().convert(
throw factory.getJdbcServices().getSqlExceptionHelper().convert(
sqle,
"could not load collection element by index",
getSQLString()
@ -2292,7 +2281,7 @@ public abstract class Loader {
result = doQueryAndInitializeNonLazyCollections( session, qp, false );
}
catch (SQLException sqle) {
throw factory.getSQLExceptionHelper().convert(
throw factory.getJdbcServices().getSqlExceptionHelper().convert(
sqle,
"could not load an entity batch: " +
MessageHelper.infoString( getEntityPersisters()[0], ids, getFactory() ),
@ -2329,7 +2318,7 @@ public abstract class Loader {
);
}
catch (SQLException sqle) {
throw factory.getSQLExceptionHelper().convert(
throw factory.getJdbcServices().getSqlExceptionHelper().convert(
sqle,
"could not initialize a collection: " +
MessageHelper.collectionInfoString( getCollectionPersisters()[0], id, getFactory() ),
@ -2364,7 +2353,7 @@ public abstract class Loader {
);
}
catch (SQLException sqle) {
throw factory.getSQLExceptionHelper().convert(
throw factory.getJdbcServices().getSqlExceptionHelper().convert(
sqle,
"could not initialize a collection batch: " +
MessageHelper.collectionInfoString( getCollectionPersisters()[0], ids, getFactory() ),
@ -2395,7 +2384,7 @@ public abstract class Loader {
);
}
catch (SQLException sqle) {
throw factory.getSQLExceptionHelper().convert(
throw factory.getJdbcServices().getSqlExceptionHelper().convert(
sqle,
"could not load collection by subselect: " +
MessageHelper.collectionInfoString( getCollectionPersisters()[0], ids, getFactory() ),
@ -2613,7 +2602,7 @@ public abstract class Loader {
result = doQueryAndInitializeNonLazyCollections( session, queryParameters, true, forcedResultTransformer );
}
catch (SQLException sqle) {
throw factory.getSQLExceptionHelper().convert(
throw factory.getJdbcServices().getSqlExceptionHelper().convert(
sqle,
"could not execute query",
getSQLString()
@ -2730,7 +2719,7 @@ public abstract class Loader {
}
catch (SQLException sqle) {
throw factory.getSQLExceptionHelper().convert(
throw factory.getJdbcServices().getSqlExceptionHelper().convert(
sqle,
"could not execute query using scroll",
getSQLString()

View File

@ -19,7 +19,6 @@ import org.hibernate.LockMode;
import org.hibernate.LockOptions;
import org.hibernate.QueryException;
import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.spi.LoadQueryInfluencers;
@ -233,7 +232,7 @@ public class CriteriaLoader extends OuterJoinLoader {
locks.setScope( lockOptions.getScope() );
locks.setTimeOut( lockOptions.getTimeOut() );
final Map keyColumnNames = dialect.forUpdateOfColumns() ? new HashMap() : null;
final Map<String,String[]> keyColumnNames = dialect.forUpdateOfColumns() ? new HashMap() : null;
final String[] drivingSqlAliases = getAliases();
for ( int i = 0; i < drivingSqlAliases.length; i++ ) {
final LockMode lockMode = lockOptions.getAliasSpecificLockMode( drivingSqlAliases[i] );

View File

@ -19,7 +19,6 @@ import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.LockOptions;
import org.hibernate.QueryException;
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import org.hibernate.cache.spi.QueryCache;
import org.hibernate.cache.spi.QueryKey;
@ -44,7 +43,6 @@ import org.hibernate.type.CollectionType;
import org.hibernate.type.EntityType;
import org.hibernate.type.Type;
/**
* Extension point for loaders which use a SQL result set with "unexpected" column aliases.
*
@ -56,7 +54,7 @@ public class CustomLoader extends Loader {
// Currently *not* cachable if autodiscover types is in effect (e.g. "select * ...")
private final String sql;
private final Set<Serializable> querySpaces = new HashSet<Serializable>();
private final Set<Serializable> querySpaces = new HashSet<>();
private final Map namedParameterBindPoints;
private final Queryable[] entityPersisters;
@ -89,24 +87,24 @@ public class CustomLoader extends Loader {
this.querySpaces.addAll( customQuery.getQuerySpaces() );
this.namedParameterBindPoints = customQuery.getNamedParameterBindPoints();
List<Queryable> entityPersisters = new ArrayList<Queryable>();
List<Integer> entityOwners = new ArrayList<Integer>();
List<EntityAliases> entityAliases = new ArrayList<EntityAliases>();
List<Queryable> entityPersisters = new ArrayList<>();
List<Integer> entityOwners = new ArrayList<>();
List<EntityAliases> entityAliases = new ArrayList<>();
List<QueryableCollection> collectionPersisters = new ArrayList<QueryableCollection>();
List<Integer> collectionOwners = new ArrayList<Integer>();
List<CollectionAliases> collectionAliases = new ArrayList<CollectionAliases>();
List<QueryableCollection> collectionPersisters = new ArrayList<>();
List<Integer> collectionOwners = new ArrayList<>();
List<CollectionAliases> collectionAliases = new ArrayList<>();
List<LockMode> lockModes = new ArrayList<LockMode>();
List<ResultColumnProcessor> resultColumnProcessors = new ArrayList<ResultColumnProcessor>();
List<Return> nonScalarReturnList = new ArrayList<Return>();
List<Type> resultTypes = new ArrayList<Type>();
List<String> specifiedAliases = new ArrayList<String>();
List<LockMode> lockModes = new ArrayList<>();
List<ResultColumnProcessor> resultColumnProcessors = new ArrayList<>();
List<Return> nonScalarReturnList = new ArrayList<>();
List<Type> resultTypes = new ArrayList<>();
List<String> specifiedAliases = new ArrayList<>();
int returnableCounter = 0;
boolean hasScalars = false;
List<Boolean> includeInResultRowList = new ArrayList<Boolean>();
List<Boolean> includeInResultRowList = new ArrayList<>();
for ( Return rtn : customQuery.getCustomQueryReturns() ) {
if ( rtn instanceof ScalarReturn ) {
@ -115,7 +113,7 @@ public class CustomLoader extends Loader {
specifiedAliases.add( scalarRtn.getColumnAlias() );
resultColumnProcessors.add(
new ScalarResultColumnProcessor(
StringHelper.unquote( scalarRtn.getColumnAlias(), factory.getDialect() ),
StringHelper.unquote( scalarRtn.getColumnAlias(), factory.getJdbcServices().getDialect() ),
scalarRtn.getType()
)
);
@ -132,7 +130,7 @@ public class CustomLoader extends Loader {
int i = 0;
for ( ScalarReturn scalarReturn : constructorReturn.getScalars() ) {
scalarProcessors[i++] = new ScalarResultColumnProcessor(
StringHelper.unquote( scalarReturn.getColumnAlias(), factory.getDialect() ),
StringHelper.unquote( scalarReturn.getColumnAlias(), factory.getJdbcServices().getDialect() ),
scalarReturn.getType()
);
}
@ -143,7 +141,7 @@ public class CustomLoader extends Loader {
}
else if ( rtn instanceof RootReturn ) {
RootReturn rootRtn = (RootReturn) rtn;
Queryable persister = (Queryable) factory.getEntityPersister( rootRtn.getEntityName() );
Queryable persister = (Queryable) factory.getMetamodel().entityPersister( rootRtn.getEntityName() );
entityPersisters.add( persister );
lockModes.add( ( rootRtn.getLockMode() ) );
resultColumnProcessors.add( new NonScalarResultColumnProcessor( returnableCounter++ ) );
@ -158,7 +156,7 @@ public class CustomLoader extends Loader {
else if ( rtn instanceof CollectionReturn ) {
CollectionReturn collRtn = (CollectionReturn) rtn;
String role = collRtn.getOwnerEntityName() + "." + collRtn.getOwnerProperty();
QueryableCollection persister = (QueryableCollection) factory.getCollectionPersister( role );
QueryableCollection persister = (QueryableCollection) factory.getMetamodel().collectionPersister( role );
collectionPersisters.add( persister );
lockModes.add( collRtn.getLockMode() );
resultColumnProcessors.add( new NonScalarResultColumnProcessor( returnableCounter++ ) );
@ -187,7 +185,7 @@ public class CustomLoader extends Loader {
Queryable ownerPersister = determineAppropriateOwnerPersister( ownerDescriptor );
EntityType fetchedType = (EntityType) ownerPersister.getPropertyType( fetchRtn.getOwnerProperty() );
String entityName = fetchedType.getAssociatedEntityName( getFactory() );
Queryable persister = (Queryable) factory.getEntityPersister( entityName );
Queryable persister = (Queryable) factory.getMetamodel().entityPersister( entityName );
entityPersisters.add( persister );
nonScalarReturnList.add( rtn );
specifiedAliases.add( fetchRtn.getAlias() );
@ -203,7 +201,7 @@ public class CustomLoader extends Loader {
lockModes.add( fetchRtn.getLockMode() );
Queryable ownerPersister = determineAppropriateOwnerPersister( ownerDescriptor );
String role = ownerPersister.getEntityName() + '.' + fetchRtn.getOwnerProperty();
QueryableCollection persister = (QueryableCollection) factory.getCollectionPersister( role );
QueryableCollection persister = (QueryableCollection) factory.getMetamodel().collectionPersister( role );
collectionPersisters.add( persister );
nonScalarReturnList.add( rtn );
specifiedAliases.add( fetchRtn.getAlias() );
@ -268,7 +266,7 @@ public class CustomLoader extends Loader {
else if ( ownerDescriptor instanceof CollectionReturn ) {
CollectionReturn collRtn = (CollectionReturn) ownerDescriptor;
String role = collRtn.getOwnerEntityName() + "." + collRtn.getOwnerProperty();
CollectionPersister persister = getFactory().getCollectionPersister( role );
CollectionPersister persister = getFactory().getMetamodel().collectionPersister( role );
EntityType ownerType = (EntityType) persister.getElementType();
entityName = ownerType.getAssociatedEntityName( getFactory() );
}
@ -291,7 +289,7 @@ public class CustomLoader extends Loader {
throw new HibernateException( "Could not determine fetch owner : " + ownerDescriptor );
}
return (Queryable) getFactory().getEntityPersister( entityName );
return (Queryable) getFactory().getMetamodel().entityPersister( entityName );
}
@Override
@ -482,8 +480,8 @@ public class CustomLoader extends Loader {
JdbcResultMetadata metadata = new JdbcResultMetadata( getFactory(), rs );
rowProcessor.prepareForAutoDiscovery( metadata );
List<String> aliases = new ArrayList<String>();
List<Type> types = new ArrayList<Type>();
List<String> aliases = new ArrayList<>();
List<Type> types = new ArrayList<>();
for ( ResultColumnProcessor resultProcessor : rowProcessor.getColumnProcessors() ) {
resultProcessor.performDiscovery( metadata, types, aliases );
}
@ -527,9 +525,7 @@ public class CustomLoader extends Loader {
* *afterQuery* {@link #list(SharedSessionContractImplementor, QueryParameters)} has already been called. It's a bit of a
* chicken-and-the-egg issue since {@link #autoDiscoverTypes(ResultSet)} needs the {@link ResultSet}.
* <p/>
* As a hacky workaround, override
* {@link #putResultInQueryCache(SharedSessionContractImplementor, QueryParameters, Type[], QueryCache, QueryKey, List)} here
* and provide the {@link #resultTypes}.
* As a hacky workaround, overriden here to provide the {@link #resultTypes}.
*
* see HHH-3051
*/

View File

@ -21,7 +21,6 @@ import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.LockOptions;
import org.hibernate.QueryException;
import org.hibernate.ScrollableResults;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.spi.QueryParameters;
import org.hibernate.engine.spi.SessionFactoryImplementor;
@ -73,7 +72,7 @@ public class QueryLoader extends BasicLoader {
//private Type[] sqlResultTypes;
private Type[] queryReturnTypes;
private final Map<String, String> sqlAliasByEntityAlias = new HashMap<String, String>( 8 );
private final Map<String, String> sqlAliasByEntityAlias = new HashMap<>( 8 );
private EntityType[] ownerAssociationTypes;
private int[] owners;
@ -167,6 +166,7 @@ public class QueryLoader extends BasicLoader {
owners[i] = -1; //by default
if ( element.isFetch() ) {
//noinspection StatementWithEmptyBody
if ( element.isCollectionJoin() || element.getQueryableCollection() != null ) {
// This is now handled earlier in this method.
}

View File

@ -14,5 +14,5 @@ package org.hibernate.query;
* @author Steve Ebersole
* @author Gavin King
*/
public interface BasicQueryContract extends org.hibernate.BasicQueryContract {
public interface CommonQueryContract extends org.hibernate.BasicQueryContract {
}

View File

@ -12,7 +12,6 @@ import java.time.OffsetDateTime;
import java.time.ZonedDateTime;
import java.util.Calendar;
import java.util.Date;
import java.util.Spliterator;
import java.util.stream.Stream;
import javax.persistence.FlushModeType;
import javax.persistence.LockModeType;
@ -41,7 +40,7 @@ import org.hibernate.engine.spi.RowSelection;
*/
@Incubating
@SuppressWarnings("UnusedDeclaration")
public interface Query<R> extends TypedQuery<R>, org.hibernate.Query<R>, BasicQueryContract {
public interface Query<R> extends TypedQuery<R>, org.hibernate.Query<R>, CommonQueryContract {
/**
* Get the QueryProducer this Query originates from.
*/

View File

@ -11,7 +11,6 @@ import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.query.Query;
import org.hibernate.query.spi.ScrollableResultsImplementor;

View File

@ -26,7 +26,6 @@ import org.hibernate.LockOptions;
import org.hibernate.MappingException;
import org.hibernate.QueryException;
import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.engine.ResultSetMappingDefinition;
import org.hibernate.engine.query.spi.sql.NativeSQLQueryConstructorReturn;
import org.hibernate.engine.query.spi.sql.NativeSQLQueryReturn;
@ -578,6 +577,7 @@ public class NativeQueryImpl<T> extends AbstractProducedQuery<T> implements Nati
}
@Override
@SuppressWarnings("unchecked")
public NativeQueryImplementor<T> setParameter(QueryParameter parameter, Object value, Type type) {
super.setParameter( parameter, value, type );
return this;
@ -602,115 +602,117 @@ public class NativeQueryImpl<T> extends AbstractProducedQuery<T> implements Nati
}
@Override
public NativeQueryImplementor setParameter(String name, Object value, TemporalType temporalType) {
public NativeQueryImplementor<T> setParameter(String name, Object value, TemporalType temporalType) {
super.setParameter( name, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor setParameter(int position, Object value, TemporalType temporalType) {
public NativeQueryImplementor<T> setParameter(int position, Object value, TemporalType temporalType) {
super.setParameter( position, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor setParameterList(QueryParameter parameter, Collection values) {
public NativeQueryImplementor<T> setParameterList(QueryParameter parameter, Collection values) {
super.setParameterList( parameter, values );
return this;
}
@Override
public NativeQueryImplementor setParameterList(String name, Collection values) {
public NativeQueryImplementor<T> setParameterList(String name, Collection values) {
super.setParameterList( name, values );
return this;
}
@Override
public NativeQueryImplementor setParameterList(String name, Collection values, Type type) {
public NativeQueryImplementor<T> setParameterList(String name, Collection values, Type type) {
super.setParameterList( name, values, type );
return this;
}
@Override
public NativeQueryImplementor setParameterList(String name, Object[] values, Type type) {
public NativeQueryImplementor<T> setParameterList(String name, Object[] values, Type type) {
super.setParameterList( name, values, type );
return this;
}
@Override
public NativeQueryImplementor setParameterList(String name, Object[] values) {
public NativeQueryImplementor<T> setParameterList(String name, Object[] values) {
super.setParameterList( name, values );
return this;
}
@Override
public NativeQueryImplementor setParameter(Parameter param, Calendar value, TemporalType temporalType) {
@SuppressWarnings("unchecked")
public NativeQueryImplementor<T> setParameter(Parameter param, Calendar value, TemporalType temporalType) {
super.setParameter( param, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor setParameter(Parameter param, Date value, TemporalType temporalType) {
@SuppressWarnings("unchecked")
public NativeQueryImplementor<T> setParameter(Parameter param, Date value, TemporalType temporalType) {
super.setParameter( param, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor setParameter(String name, Calendar value, TemporalType temporalType) {
public NativeQueryImplementor<T> setParameter(String name, Calendar value, TemporalType temporalType) {
super.setParameter( name, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor setParameter(String name, Date value, TemporalType temporalType) {
public NativeQueryImplementor<T> setParameter(String name, Date value, TemporalType temporalType) {
super.setParameter( name, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor setParameter(int position, Calendar value, TemporalType temporalType) {
public NativeQueryImplementor<T> setParameter(int position, Calendar value, TemporalType temporalType) {
super.setParameter( position, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor setParameter(int position, Date value, TemporalType temporalType) {
public NativeQueryImplementor<T> setParameter(int position, Date value, TemporalType temporalType) {
super.setParameter( position, value, temporalType );
return this;
}
@Override
public NativeQueryImplementor setResultTransformer(ResultTransformer transformer) {
public NativeQueryImplementor<T> setResultTransformer(ResultTransformer transformer) {
super.setResultTransformer( transformer );
return this;
}
@Override
public NativeQueryImplementor setProperties(Map map) {
public NativeQueryImplementor<T> setProperties(Map map) {
super.setProperties( map );
return this;
}
@Override
public NativeQueryImplementor setProperties(Object bean) {
public NativeQueryImplementor<T> setProperties(Object bean) {
super.setProperties( bean );
return this;
}
@Override
public NativeQueryImplementor setMaxResults(int maxResult) {
public NativeQueryImplementor<T> setMaxResults(int maxResult) {
super.setMaxResults( maxResult );
return this;
}
@Override
public NativeQueryImplementor setFirstResult(int startPosition) {
public NativeQueryImplementor<T> setFirstResult(int startPosition) {
super.setFirstResult( startPosition );
return this;
}
@Override
public NativeQueryImplementor setHint(String hintName, Object value) {
public NativeQueryImplementor<T> setHint(String hintName, Object value) {
super.setHint( hintName, value );
return this;
}

View File

@ -16,10 +16,10 @@ import org.hibernate.query.spi.ScrollableResultsImplementor;
* @since 5.2
*/
@Incubating
public class ScrollableResultsIterator<T> implements CloseableIterator {
class ScrollableResultsIterator<T> implements CloseableIterator {
private final ScrollableResultsImplementor scrollableResults;
public ScrollableResultsIterator(ScrollableResultsImplementor scrollableResults) {
ScrollableResultsIterator(ScrollableResultsImplementor scrollableResults) {
this.scrollableResults = scrollableResults;
}