fix some minor generics issues
This commit is contained in:
parent
2f72d76266
commit
eb9e70e30d
|
@ -39,7 +39,7 @@ public interface QueryResultsCache {
|
|||
*/
|
||||
boolean put(
|
||||
QueryKey key,
|
||||
List result,
|
||||
List<?> result,
|
||||
SharedSessionContractImplementor session) throws HibernateException;
|
||||
|
||||
/**
|
||||
|
@ -53,7 +53,7 @@ public interface QueryResultsCache {
|
|||
*
|
||||
* @throws HibernateException Indicates a problem delegating to the underlying cache.
|
||||
*/
|
||||
List get(
|
||||
List<?> get(
|
||||
QueryKey key,
|
||||
Set<String> spaces,
|
||||
SharedSessionContractImplementor session) throws HibernateException;
|
||||
|
@ -69,7 +69,7 @@ public interface QueryResultsCache {
|
|||
*
|
||||
* @throws HibernateException Indicates a problem delegating to the underlying cache.
|
||||
*/
|
||||
List get(
|
||||
List<?> get(
|
||||
QueryKey key,
|
||||
String[] spaces,
|
||||
SharedSessionContractImplementor session) throws HibernateException;
|
||||
|
|
|
@ -505,9 +505,9 @@ public interface CommonQueryContract {
|
|||
CommonQueryContract setProperties(Object bean);
|
||||
|
||||
/**
|
||||
* Bind the values of the given Map for each named parameters of the query,
|
||||
* matching key names with parameter names and mapping value types to
|
||||
* Hibernate types using heuristics.
|
||||
* Bind the values of the given {@code Map} to named parameters of the query,
|
||||
* matching key names with parameter names and mapping value types to Hibernate
|
||||
* types using heuristics.
|
||||
*
|
||||
* @param bean a {@link Map} of names to arguments
|
||||
*
|
||||
|
|
|
@ -32,7 +32,7 @@ public interface MutationQuery extends CommonQueryContract {
|
|||
* Execute an insert, update, or delete statement, and return the
|
||||
* number of affected entities.
|
||||
* <p>
|
||||
* For use with instances of {@code Query<Void>} created using
|
||||
* For use with instances of {@code MutationQuery} created using
|
||||
* {@link QueryProducer#createMutationQuery(String)},
|
||||
* {@link QueryProducer#createNamedMutationQuery(String)},
|
||||
* {@link QueryProducer#createNativeMutationQuery(String)},
|
||||
|
@ -166,7 +166,7 @@ public interface MutationQuery extends CommonQueryContract {
|
|||
MutationQuery setProperties(Object bean);
|
||||
|
||||
@Override
|
||||
MutationQuery setProperties(Map bean);
|
||||
MutationQuery setProperties(@SuppressWarnings("rawtypes") Map bean);
|
||||
|
||||
@Override
|
||||
MutationQuery setHibernateFlushMode(FlushMode flushMode);
|
||||
|
|
|
@ -452,5 +452,5 @@ public interface SelectionQuery extends CommonQueryContract {
|
|||
SelectionQuery setProperties(Object bean);
|
||||
|
||||
@Override
|
||||
SelectionQuery setProperties(Map bean);
|
||||
SelectionQuery setProperties(@SuppressWarnings("rawtypes") Map bean);
|
||||
}
|
||||
|
|
|
@ -49,12 +49,12 @@ public class DelegatingQueryOptions implements QueryOptions {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TupleTransformer getTupleTransformer() {
|
||||
public TupleTransformer<?> getTupleTransformer() {
|
||||
return queryOptions.getTupleTransformer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultListTransformer getResultListTransformer() {
|
||||
public ResultListTransformer<?> getResultListTransformer() {
|
||||
return queryOptions.getResultListTransformer();
|
||||
}
|
||||
|
||||
|
|
|
@ -54,13 +54,13 @@ public interface QueryOptions {
|
|||
* Transformer applied to the query to transform the structure of each "row"
|
||||
* in the results
|
||||
*/
|
||||
TupleTransformer getTupleTransformer();
|
||||
TupleTransformer<?> getTupleTransformer();
|
||||
|
||||
/**
|
||||
* Transformer applied to the query to transform the structure of the
|
||||
* overall results
|
||||
*/
|
||||
ResultListTransformer getResultListTransformer();
|
||||
ResultListTransformer<?> getResultListTransformer();
|
||||
|
||||
/**
|
||||
* Should results from the query be cached?
|
||||
|
@ -167,13 +167,8 @@ public interface QueryOptions {
|
|||
*/
|
||||
default boolean hasLimit() {
|
||||
final Limit limit = getLimit();
|
||||
if ( limit != null ) {
|
||||
if ( limit.getFirstRow() != null || limit.getMaxRows() != null ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return limit != null
|
||||
&& (limit.getFirstRow() != null || limit.getMaxRows() != null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.hibernate.internal.EmptyScrollableResults;
|
|||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
||||
import org.hibernate.query.IllegalQueryOperationException;
|
||||
import org.hibernate.query.TupleTransformer;
|
||||
import org.hibernate.query.criteria.JpaSelection;
|
||||
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
|
@ -252,9 +253,12 @@ public class ConcreteSqmSelectQueryPlan<R> implements SelectQueryPlan<R> {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
TupleTransformer<R> tupleTransformer = (TupleTransformer<R>) queryOptions.getTupleTransformer();
|
||||
return new RowTransformerTupleTransformerAdapter<R>(
|
||||
ArrayHelper.toStringArray( aliases ),
|
||||
queryOptions.getTupleTransformer()
|
||||
tupleTransformer
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -213,8 +213,8 @@ public class JdbcSelectExecutorStandardImpl implements JdbcSelectExecutor {
|
|||
final Integer timeout = queryOptions.getTimeout();
|
||||
final FlushMode flushMode = queryOptions.getFlushMode();
|
||||
final AppliedGraph appliedGraph = queryOptions.getAppliedGraph();
|
||||
final TupleTransformer tupleTransformer = queryOptions.getTupleTransformer();
|
||||
final ResultListTransformer resultListTransformer = queryOptions.getResultListTransformer();
|
||||
final TupleTransformer<?> tupleTransformer = queryOptions.getTupleTransformer();
|
||||
final ResultListTransformer<?> resultListTransformer = queryOptions.getResultListTransformer();
|
||||
final Boolean resultCachingEnabled = queryOptions.isResultCachingEnabled();
|
||||
final CacheRetrieveMode cacheRetrieveMode = queryOptions.getCacheRetrieveMode();
|
||||
final CacheStoreMode cacheStoreMode = queryOptions.getCacheStoreMode();
|
||||
|
@ -251,12 +251,12 @@ public class JdbcSelectExecutorStandardImpl implements JdbcSelectExecutor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TupleTransformer getTupleTransformer() {
|
||||
public TupleTransformer<?> getTupleTransformer() {
|
||||
return tupleTransformer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultListTransformer getResultListTransformer() {
|
||||
public ResultListTransformer<?> getResultListTransformer() {
|
||||
return resultListTransformer;
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,9 @@ public class JdbcSelectExecutorStandardImpl implements JdbcSelectExecutor {
|
|||
);
|
||||
|
||||
if ( rowTransformer == null ) {
|
||||
final TupleTransformer<R> tupleTransformer = executionContext.getQueryOptions().getTupleTransformer();
|
||||
@SuppressWarnings("unchecked")
|
||||
final TupleTransformer<R> tupleTransformer = (TupleTransformer<R>)
|
||||
executionContext.getQueryOptions().getTupleTransformer();
|
||||
if ( tupleTransformer == null ) {
|
||||
rowTransformer = RowTransformerPassThruImpl.instance();
|
||||
}
|
||||
|
@ -449,12 +451,11 @@ public class JdbcSelectExecutorStandardImpl implements JdbcSelectExecutor {
|
|||
|
||||
private <T> int getResultSize(T result) {
|
||||
if ( result instanceof List ) {
|
||||
return ( (List) result ).size();
|
||||
return ( (List<?>) result ).size();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private JdbcValues resolveJdbcValuesSource(
|
||||
String queryIdentifier,
|
||||
JdbcSelect jdbcSelect,
|
||||
|
@ -465,7 +466,7 @@ public class JdbcSelectExecutorStandardImpl implements JdbcSelectExecutor {
|
|||
final SessionFactoryImplementor factory = session.getFactory();
|
||||
final boolean queryCacheEnabled = factory.getSessionFactoryOptions().isQueryCacheEnabled();
|
||||
|
||||
final List<Object> cachedResults;
|
||||
final List<?> cachedResults;
|
||||
final CacheMode cacheMode = JdbcExecHelper.resolveCacheMode( executionContext );
|
||||
|
||||
final JdbcValuesMappingProducer mappingProducer = jdbcSelect.getJdbcValuesMappingProducer();
|
||||
|
|
|
@ -40,11 +40,11 @@ public class JdbcValuesCacheHit extends AbstractJdbcValues {
|
|||
this.resolvedMapping = resolvedMapping;
|
||||
}
|
||||
|
||||
public JdbcValuesCacheHit(List<Object> cachedResults, JdbcValuesMapping resolvedMapping) {
|
||||
public JdbcValuesCacheHit(List<?> cachedResults, JdbcValuesMapping resolvedMapping) {
|
||||
this( extractData( cachedResults ), resolvedMapping );
|
||||
}
|
||||
|
||||
private static Object[][] extractData(List<Object> cachedResults) {
|
||||
private static Object[][] extractData(List<?> cachedResults) {
|
||||
if ( CollectionHelper.isEmpty( cachedResults ) ) {
|
||||
return NO_DATA;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue