diff --git a/hibernate-core/src/main/java/org/hibernate/BasicQueryContract.java b/hibernate-core/src/main/java/org/hibernate/BasicQueryContract.java
index 374bfb07c3..63685e544d 100644
--- a/hibernate-core/src/main/java/org/hibernate/BasicQueryContract.java
+++ b/hibernate-core/src/main/java/org/hibernate/BasicQueryContract.java
@@ -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 in seconds. 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.
diff --git a/hibernate-core/src/main/java/org/hibernate/engine/query/spi/HQLQueryPlan.java b/hibernate-core/src/main/java/org/hibernate/engine/query/spi/HQLQueryPlan.java
index 4b758f40e8..113de2d970 100644
--- a/hibernate-core/src/main/java/org/hibernate/engine/query/spi/HQLQueryPlan.java
+++ b/hibernate-core/src/main/java/org/hibernate/engine/query/spi/HQLQueryPlan.java
@@ -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;
diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SharedSessionContractImplementor.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SharedSessionContractImplementor.java
index 81e03d7339..b6d3756bb1 100644
--- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SharedSessionContractImplementor.java
+++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SharedSessionContractImplementor.java
@@ -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}
*
*
* {@link org.hibernate.engine.jdbc.LobCreationContext} to act as the context for JDBC LOB instance creation
diff --git a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/QueryTranslatorImpl.java b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/QueryTranslatorImpl.java
index 8442a5f94e..dbb9a56a65 100644
--- a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/QueryTranslatorImpl.java
+++ b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/QueryTranslatorImpl.java
@@ -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;
diff --git a/hibernate-core/src/main/java/org/hibernate/hql/internal/classic/QueryTranslatorImpl.java b/hibernate-core/src/main/java/org/hibernate/hql/internal/classic/QueryTranslatorImpl.java
index a02d09af9e..ed6562baea 100644
--- a/hibernate-core/src/main/java/org/hibernate/hql/internal/classic/QueryTranslatorImpl.java
+++ b/hibernate-core/src/main/java/org/hibernate/hql/internal/classic/QueryTranslatorImpl.java
@@ -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;
diff --git a/hibernate-core/src/main/java/org/hibernate/hql/spi/QueryTranslator.java b/hibernate-core/src/main/java/org/hibernate/hql/spi/QueryTranslator.java
index 679479ae70..1095e90f87 100644
--- a/hibernate-core/src/main/java/org/hibernate/hql/spi/QueryTranslator.java
+++ b/hibernate-core/src/main/java/org/hibernate/hql/spi/QueryTranslator.java
@@ -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;
diff --git a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java
index b301e580fa..7ae0ee5d29 100644
--- a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java
+++ b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java
@@ -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;
diff --git a/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java
index f109b9236c..12baa68b62 100755
--- a/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java
+++ b/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java
@@ -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 ) {
diff --git a/hibernate-core/src/main/java/org/hibernate/loader/Loader.java b/hibernate-core/src/main/java/org/hibernate/loader/Loader.java
index e65a135ef8..01f2125e49 100644
--- a/hibernate-core/src/main/java/org/hibernate/loader/Loader.java
+++ b/hibernate-core/src/main/java/org/hibernate/loader/Loader.java
@@ -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()
diff --git a/hibernate-core/src/main/java/org/hibernate/loader/criteria/CriteriaLoader.java b/hibernate-core/src/main/java/org/hibernate/loader/criteria/CriteriaLoader.java
index c984248b02..9479626213 100644
--- a/hibernate-core/src/main/java/org/hibernate/loader/criteria/CriteriaLoader.java
+++ b/hibernate-core/src/main/java/org/hibernate/loader/criteria/CriteriaLoader.java
@@ -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 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] );
diff --git a/hibernate-core/src/main/java/org/hibernate/loader/custom/CustomLoader.java b/hibernate-core/src/main/java/org/hibernate/loader/custom/CustomLoader.java
index 026174719a..fe53fa1ba2 100755
--- a/hibernate-core/src/main/java/org/hibernate/loader/custom/CustomLoader.java
+++ b/hibernate-core/src/main/java/org/hibernate/loader/custom/CustomLoader.java
@@ -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 querySpaces = new HashSet();
+ private final Set 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 entityPersisters = new ArrayList();
- List entityOwners = new ArrayList();
- List entityAliases = new ArrayList();
+ List entityPersisters = new ArrayList<>();
+ List entityOwners = new ArrayList<>();
+ List entityAliases = new ArrayList<>();
- List collectionPersisters = new ArrayList();
- List collectionOwners = new ArrayList();
- List collectionAliases = new ArrayList();
+ List collectionPersisters = new ArrayList<>();
+ List collectionOwners = new ArrayList<>();
+ List collectionAliases = new ArrayList<>();
- List lockModes = new ArrayList();
- List resultColumnProcessors = new ArrayList();
- List nonScalarReturnList = new ArrayList();
- List resultTypes = new ArrayList();
- List specifiedAliases = new ArrayList();
+ List lockModes = new ArrayList<>();
+ List resultColumnProcessors = new ArrayList<>();
+ List nonScalarReturnList = new ArrayList<>();
+ List resultTypes = new ArrayList<>();
+ List specifiedAliases = new ArrayList<>();
int returnableCounter = 0;
boolean hasScalars = false;
- List includeInResultRowList = new ArrayList();
+ List 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 aliases = new ArrayList();
- List types = new ArrayList();
+ List aliases = new ArrayList<>();
+ List 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}.
*
- * 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
*/
diff --git a/hibernate-core/src/main/java/org/hibernate/loader/hql/QueryLoader.java b/hibernate-core/src/main/java/org/hibernate/loader/hql/QueryLoader.java
index e83adbace0..e57e4893fe 100644
--- a/hibernate-core/src/main/java/org/hibernate/loader/hql/QueryLoader.java
+++ b/hibernate-core/src/main/java/org/hibernate/loader/hql/QueryLoader.java
@@ -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 sqlAliasByEntityAlias = new HashMap( 8 );
+ private final Map 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.
}
diff --git a/hibernate-core/src/main/java/org/hibernate/query/BasicQueryContract.java b/hibernate-core/src/main/java/org/hibernate/query/CommonQueryContract.java
similarity index 86%
rename from hibernate-core/src/main/java/org/hibernate/query/BasicQueryContract.java
rename to hibernate-core/src/main/java/org/hibernate/query/CommonQueryContract.java
index dffe3d124e..5c1ee9bf92 100644
--- a/hibernate-core/src/main/java/org/hibernate/query/BasicQueryContract.java
+++ b/hibernate-core/src/main/java/org/hibernate/query/CommonQueryContract.java
@@ -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 {
}
diff --git a/hibernate-core/src/main/java/org/hibernate/query/Query.java b/hibernate-core/src/main/java/org/hibernate/query/Query.java
index b32903370a..74a99d0e28 100644
--- a/hibernate-core/src/main/java/org/hibernate/query/Query.java
+++ b/hibernate-core/src/main/java/org/hibernate/query/Query.java
@@ -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 extends TypedQuery, org.hibernate.Query, BasicQueryContract {
+public interface Query extends TypedQuery, org.hibernate.Query, CommonQueryContract {
/**
* Get the QueryProducer this Query originates from.
*/
diff --git a/hibernate-core/src/main/java/org/hibernate/query/internal/CollectionFilterImpl.java b/hibernate-core/src/main/java/org/hibernate/query/internal/CollectionFilterImpl.java
index ee6120a308..3bf8534105 100644
--- a/hibernate-core/src/main/java/org/hibernate/query/internal/CollectionFilterImpl.java
+++ b/hibernate-core/src/main/java/org/hibernate/query/internal/CollectionFilterImpl.java
@@ -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;
diff --git a/hibernate-core/src/main/java/org/hibernate/query/internal/NativeQueryImpl.java b/hibernate-core/src/main/java/org/hibernate/query/internal/NativeQueryImpl.java
index 3c22019de7..bffebed89e 100644
--- a/hibernate-core/src/main/java/org/hibernate/query/internal/NativeQueryImpl.java
+++ b/hibernate-core/src/main/java/org/hibernate/query/internal/NativeQueryImpl.java
@@ -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 extends AbstractProducedQuery implements Nati
}
@Override
+ @SuppressWarnings("unchecked")
public NativeQueryImplementor setParameter(QueryParameter parameter, Object value, Type type) {
super.setParameter( parameter, value, type );
return this;
@@ -602,115 +602,117 @@ public class NativeQueryImpl extends AbstractProducedQuery implements Nati
}
@Override
- public NativeQueryImplementor setParameter(String name, Object value, TemporalType temporalType) {
+ public NativeQueryImplementor 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 setParameter(int position, Object value, TemporalType temporalType) {
super.setParameter( position, value, temporalType );
return this;
}
@Override
- public NativeQueryImplementor setParameterList(QueryParameter parameter, Collection values) {
+ public NativeQueryImplementor setParameterList(QueryParameter parameter, Collection values) {
super.setParameterList( parameter, values );
return this;
}
@Override
- public NativeQueryImplementor setParameterList(String name, Collection values) {
+ public NativeQueryImplementor setParameterList(String name, Collection values) {
super.setParameterList( name, values );
return this;
}
@Override
- public NativeQueryImplementor setParameterList(String name, Collection values, Type type) {
+ public NativeQueryImplementor 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 setParameterList(String name, Object[] values, Type type) {
super.setParameterList( name, values, type );
return this;
}
@Override
- public NativeQueryImplementor setParameterList(String name, Object[] values) {
+ public NativeQueryImplementor 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 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 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 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 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 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 setParameter(int position, Date value, TemporalType temporalType) {
super.setParameter( position, value, temporalType );
return this;
}
@Override
- public NativeQueryImplementor setResultTransformer(ResultTransformer transformer) {
+ public NativeQueryImplementor setResultTransformer(ResultTransformer transformer) {
super.setResultTransformer( transformer );
return this;
}
@Override
- public NativeQueryImplementor setProperties(Map map) {
+ public NativeQueryImplementor setProperties(Map map) {
super.setProperties( map );
return this;
}
@Override
- public NativeQueryImplementor setProperties(Object bean) {
+ public NativeQueryImplementor setProperties(Object bean) {
super.setProperties( bean );
return this;
}
@Override
- public NativeQueryImplementor setMaxResults(int maxResult) {
+ public NativeQueryImplementor setMaxResults(int maxResult) {
super.setMaxResults( maxResult );
return this;
}
@Override
- public NativeQueryImplementor setFirstResult(int startPosition) {
+ public NativeQueryImplementor setFirstResult(int startPosition) {
super.setFirstResult( startPosition );
return this;
}
@Override
- public NativeQueryImplementor setHint(String hintName, Object value) {
+ public NativeQueryImplementor setHint(String hintName, Object value) {
super.setHint( hintName, value );
return this;
}
diff --git a/hibernate-core/src/main/java/org/hibernate/query/internal/ScrollableResultsIterator.java b/hibernate-core/src/main/java/org/hibernate/query/internal/ScrollableResultsIterator.java
index dedabe93f3..99069473d1 100644
--- a/hibernate-core/src/main/java/org/hibernate/query/internal/ScrollableResultsIterator.java
+++ b/hibernate-core/src/main/java/org/hibernate/query/internal/ScrollableResultsIterator.java
@@ -16,10 +16,10 @@ import org.hibernate.query.spi.ScrollableResultsImplementor;
* @since 5.2
*/
@Incubating
-public class ScrollableResultsIterator implements CloseableIterator {
+class ScrollableResultsIterator implements CloseableIterator {
private final ScrollableResultsImplementor scrollableResults;
- public ScrollableResultsIterator(ScrollableResultsImplementor scrollableResults) {
+ ScrollableResultsIterator(ScrollableResultsImplementor scrollableResults) {
this.scrollableResults = scrollableResults;
}