remove wildcards from APIs in Query hierarchy

I hate doing this but it's necessary since Query is often
used as a raw type, and the wildcards result in additional
compiler warnings at the usage site

Also clean up some other warnings I encountered in this code
This commit is contained in:
Gavin King 2021-12-12 12:12:43 +01:00
parent 82aff7cd8a
commit 8a68ee49c1
10 changed files with 119 additions and 128 deletions

View File

@ -46,8 +46,8 @@ public interface SynchronizeableQuery<T> {
*/ */
default SynchronizeableQuery<T> addSynchronizedQuerySpace(String... querySpaces) { default SynchronizeableQuery<T> addSynchronizedQuerySpace(String... querySpaces) {
if ( querySpaces != null ) { if ( querySpaces != null ) {
for ( int i = 0; i < querySpaces.length; i++ ) { for (String querySpace : querySpaces) {
addSynchronizedQuerySpace( querySpaces[i] ); addSynchronizedQuerySpace(querySpace);
} }
} }
return this; return this;
@ -84,8 +84,8 @@ public interface SynchronizeableQuery<T> {
*/ */
default SynchronizeableQuery<T> addSynchronizedEntityName(String... entityNames) throws MappingException { default SynchronizeableQuery<T> addSynchronizedEntityName(String... entityNames) throws MappingException {
if ( entityNames != null ) { if ( entityNames != null ) {
for ( int i = 0; i < entityNames.length; i++ ) { for (String entityName : entityNames) {
addSynchronizedEntityName( entityNames[i] ); addSynchronizedEntityName(entityName);
} }
} }
return this; return this;
@ -101,16 +101,15 @@ public interface SynchronizeableQuery<T> {
* *
* @throws MappingException Indicates the given class could not be resolved as an entity * @throws MappingException Indicates the given class could not be resolved as an entity
*/ */
@SuppressWarnings( "rawtypes" ) SynchronizeableQuery<T> addSynchronizedEntityClass(@SuppressWarnings("rawtypes") Class entityClass) throws MappingException;
SynchronizeableQuery<T> addSynchronizedEntityClass(Class entityClass) throws MappingException;
/** /**
* Adds one-or-more entities (by class) whose tables should be added as synchronized spaces * Adds one-or-more entities (by class) whose tables should be added as synchronized spaces
*/ */
default SynchronizeableQuery<T> addSynchronizedEntityClass(Class<?>... entityClasses) throws MappingException { default SynchronizeableQuery<T> addSynchronizedEntityClass(Class<?>... entityClasses) throws MappingException {
if ( entityClasses != null ) { if ( entityClasses != null ) {
for ( int i = 0; i < entityClasses.length; i++ ) { for (Class<?> entityClass : entityClasses) {
addSynchronizedEntityClass( entityClasses[i] ); addSynchronizedEntityClass(entityClass);
} }
} }
return this; return this;

View File

@ -222,7 +222,7 @@ public interface ProcedureCall
@Override @Override
ProcedureCall addSynchronizedEntityName(String entityName) throws MappingException; ProcedureCall addSynchronizedEntityName(String entityName) throws MappingException;
@Override @Override @SuppressWarnings("rawtypes")
ProcedureCall addSynchronizedEntityClass(Class entityClass) throws MappingException; ProcedureCall addSynchronizedEntityClass(Class entityClass) throws MappingException;
@Override @Override

View File

@ -744,7 +744,7 @@ public class ProcedureCallImpl<R>
} }
@Override @Override
public ProcedureCallImplementor<R> addSynchronizedEntityClass(Class entityClass) { public ProcedureCallImplementor<R> addSynchronizedEntityClass(@SuppressWarnings("rawtypes") Class entityClass) {
addSynchronizedQuerySpaces( getSession().getFactory().getMetamodel().entityPersister( entityClass.getName() ) ); addSynchronizedQuerySpaces( getSession().getFactory().getMetamodel().entityPersister( entityClass.getName() ) );
return this; return this;
} }
@ -801,12 +801,12 @@ public class ProcedureCallImpl<R>
} }
@Override @Override
protected void applyEntityGraphQueryHint(String hintName, RootGraphImplementor entityGraph) { protected void applyEntityGraphQueryHint(String hintName, @SuppressWarnings("rawtypes") RootGraphImplementor entityGraph) {
throw new IllegalStateException( "EntityGraph hints are not supported for ProcedureCall/StoredProcedureQuery" ); throw new IllegalStateException( "EntityGraph hints are not supported for ProcedureCall/StoredProcedureQuery" );
} }
@Override @Override
public Query<R> applyGraph(RootGraph<?> graph, GraphSemantic semantic) { public Query<R> applyGraph(@SuppressWarnings("rawtypes") RootGraph graph, GraphSemantic semantic) {
throw new IllegalStateException( "EntityGraph hints are not supported for ProcedureCall/StoredProcedureQuery" ); throw new IllegalStateException( "EntityGraph hints are not supported for ProcedureCall/StoredProcedureQuery" );
} }
@ -819,8 +819,7 @@ public class ProcedureCallImpl<R>
@Override @Override
public boolean execute() { public boolean execute() {
try { try {
final Output rtn = outputs().getCurrent(); return outputs().getCurrent() instanceof ResultSetOutput;
return ResultSetOutput.class.isInstance( rtn );
} }
catch (NoMoreOutputsException e) { catch (NoMoreOutputsException e) {
return false; return false;
@ -887,7 +886,7 @@ public class ProcedureCallImpl<R>
@Override @Override
public boolean hasMoreResults() { public boolean hasMoreResults() {
return outputs().goToNext() && ResultSetOutput.class.isInstance( outputs().getCurrent() ); return outputs().goToNext() && outputs().getCurrent() instanceof ResultSetOutput;
} }
@Override @Override
@ -897,7 +896,7 @@ public class ProcedureCallImpl<R>
if ( rtn == null ) { if ( rtn == null ) {
return -1; return -1;
} }
else if ( UpdateCountOutput.class.isInstance( rtn ) ) { else if ( rtn instanceof UpdateCountOutput ) {
return ( (UpdateCountOutput) rtn ).getUpdateCount(); return ( (UpdateCountOutput) rtn ).getUpdateCount();
} }
else { else {
@ -923,7 +922,7 @@ public class ProcedureCallImpl<R>
} }
try { try {
final Output rtn = outputs().getCurrent(); final Output rtn = outputs().getCurrent();
if ( !ResultSetOutput.class.isInstance( rtn ) ) { if ( !(rtn instanceof ResultSetOutput) ) {
throw new IllegalStateException( "Current CallableStatement ou was not a ResultSet, but getResultList was called" ); throw new IllegalStateException( "Current CallableStatement ou was not a ResultSet, but getResultList was called" );
} }

View File

@ -92,7 +92,7 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
* *
* @return {@code this}, for method chaining * @return {@code this}, for method chaining
*/ */
NativeQuery<T> addScalar(String columnAlias, BasicTypeReference<?> type); NativeQuery<T> addScalar(String columnAlias, @SuppressWarnings("rawtypes") BasicTypeReference type);
/** /**
* Declare a scalar query result. * Declare a scalar query result.
@ -106,7 +106,7 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
* *
* @return {@code this}, for method chaining * @return {@code this}, for method chaining
*/ */
NativeQuery<T> addScalar(String columnAlias, BasicDomainType<?> type); NativeQuery<T> addScalar(String columnAlias, @SuppressWarnings("rawtypes") BasicDomainType type);
/** /**
* Declare a scalar query result using the specified result type. * Declare a scalar query result using the specified result type.
@ -118,7 +118,7 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
* *
* @since 6.0 * @since 6.0
*/ */
NativeQuery<T> addScalar(String columnAlias, Class<?> javaType); NativeQuery<T> addScalar(String columnAlias, @SuppressWarnings("rawtypes") Class javaType);
/** /**
* Declare a scalar query result with an explicit conversion * Declare a scalar query result with an explicit conversion
@ -189,7 +189,7 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
* *
* @since 6.0 * @since 6.0
*/ */
NativeQuery<T> addAttributeResult(String columnAlias, Class<?> entityJavaType, String attributePath); NativeQuery<T> addAttributeResult(String columnAlias, @SuppressWarnings("rawtypes") Class entityJavaType, String attributePath);
/** /**
* Defines a result based on a specified attribute. Differs from adding a scalar in that * Defines a result based on a specified attribute. Differs from adding a scalar in that
@ -213,7 +213,7 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
* *
* @since 6.0 * @since 6.0
*/ */
NativeQuery<T> addAttributeResult(String columnAlias, SingularAttribute<?,?> attribute); NativeQuery<T> addAttributeResult(String columnAlias, @SuppressWarnings("rawtypes") SingularAttribute attribute);
/** /**
* Add a new root return mapping, returning a {@link RootReturn} to allow * Add a new root return mapping, returning a {@link RootReturn} to allow
@ -238,7 +238,7 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
* *
* @since 3.6 * @since 3.6
*/ */
RootReturn addRoot(String tableAlias, Class entityType); RootReturn addRoot(String tableAlias, @SuppressWarnings("rawtypes") Class entityType);
/** /**
* Declare a "root" entity, without specifying an alias. The expectation here is that the table alias is the * Declare a "root" entity, without specifying an alias. The expectation here is that the table alias is the
@ -281,7 +281,7 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
* *
* @return {@code this}, for method chaining * @return {@code this}, for method chaining
*/ */
NativeQuery<T> addEntity(Class<?> entityType); NativeQuery<T> addEntity(@SuppressWarnings("rawtypes") Class entityType);
/** /**
* Declare a "root" entity. * Declare a "root" entity.
@ -291,7 +291,7 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
* *
* @return {@code this}, for method chaining * @return {@code this}, for method chaining
*/ */
NativeQuery<T> addEntity(String tableAlias, Class<?> entityType); NativeQuery<T> addEntity(String tableAlias, @SuppressWarnings("rawtypes") Class entityType);
/** /**
* Declare a "root" entity, specifying a lock mode. * Declare a "root" entity, specifying a lock mode.
@ -302,7 +302,7 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
* *
* @return {@code this}, for method chaining * @return {@code this}, for method chaining
*/ */
NativeQuery<T> addEntity(String tableAlias, Class<?> entityClass, LockMode lockMode); NativeQuery<T> addEntity(String tableAlias, @SuppressWarnings("rawtypes") Class entityClass, LockMode lockMode);
/** /**
* Declare a join fetch result. * Declare a join fetch result.
@ -507,7 +507,7 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
NativeQuery<T> addSynchronizedEntityName(String entityName) throws MappingException; NativeQuery<T> addSynchronizedEntityName(String entityName) throws MappingException;
@Override @Override
NativeQuery<T> addSynchronizedEntityClass(Class<?> entityClass) throws MappingException; NativeQuery<T> addSynchronizedEntityClass(@SuppressWarnings("rawtypes") Class entityClass) throws MappingException;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -567,7 +567,7 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
@Override @Override
NativeQuery<T> setResultListTransformer(ResultListTransformer transformer); NativeQuery<T> setResultListTransformer(ResultListTransformer transformer);
@Override @Override @SuppressWarnings("deprecation")
NativeQuery<T> setResultTransformer(ResultTransformer transformer); NativeQuery<T> setResultTransformer(ResultTransformer transformer);
@ -664,7 +664,7 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, Collection<P> values); <P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, Collection<P> values);
@Override @Override
NativeQuery<T> setParameterList(String name, Collection<?> values); NativeQuery<T> setParameterList(String name, @SuppressWarnings("rawtypes") Collection values);
// @Override // @Override
// default NativeQuery<T> setParameterList(String name, Collection values, Type type) { // default NativeQuery<T> setParameterList(String name, Collection values, Type type) {
@ -678,7 +678,7 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
// NativeQuery<T> setParameterList(String name, Object[] values, Type type); // NativeQuery<T> setParameterList(String name, Object[] values, Type type);
@Override @Override
NativeQuery<T> setParameterList(String name, Object[] values, AllowableParameterType<?> type); NativeQuery<T> setParameterList(String name, Object[] values, @SuppressWarnings("rawtypes") AllowableParameterType type);
@Override @Override
NativeQuery<T> setParameterList(String name, Object[] values); NativeQuery<T> setParameterList(String name, Object[] values);
@ -702,7 +702,7 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val, BasicTypeReference<P> type); <P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val, BasicTypeReference<P> type);
@Override @Override
NativeQuery<T> setParameterList(int position, Collection<?> values); NativeQuery<T> setParameterList(int position, @SuppressWarnings("rawtypes") Collection values);
@Override @Override
<P> NativeQuery<T> setParameterList(String name, Collection<? extends P> values, Class<P> type); <P> NativeQuery<T> setParameterList(String name, Collection<? extends P> values, Class<P> type);
@ -720,7 +720,7 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
// NativeQuery<T> setParameterList(int position, Object[] values, Type type); // NativeQuery<T> setParameterList(int position, Object[] values, Type type);
@Override @Override
NativeQuery<T> setParameterList(int position, Object[] values, AllowableParameterType<?> type); NativeQuery<T> setParameterList(int position, Object[] values, @SuppressWarnings("rawtypes") AllowableParameterType type);
@Override @Override
NativeQuery<T> setParameterList(int position, Object[] values); NativeQuery<T> setParameterList(int position, Object[] values);
@ -729,5 +729,5 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
NativeQuery<T> setProperties(Object bean); NativeQuery<T> setProperties(Object bean);
@Override @Override
NativeQuery<T> setProperties(Map<?,?> bean); NativeQuery<T> setProperties(@SuppressWarnings("rawtypes") Map bean);
} }

View File

@ -77,7 +77,7 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
* *
* @return this - for method chaining * @return this - for method chaining
*/ */
Query<R> applyGraph(RootGraph<?> graph, GraphSemantic semantic); Query<R> applyGraph(@SuppressWarnings("rawtypes") RootGraph graph, GraphSemantic semantic);
/** /**
* Apply the given graph using {@linkplain GraphSemantic#FETCH fetch semantics} * Apply the given graph using {@linkplain GraphSemantic#FETCH fetch semantics}
@ -85,7 +85,7 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
* @apiNote This method calls {@link #applyGraph(RootGraph, GraphSemantic)} using * @apiNote This method calls {@link #applyGraph(RootGraph, GraphSemantic)} using
* {@link GraphSemantic#FETCH} as the semantic * {@link GraphSemantic#FETCH} as the semantic
*/ */
default Query<R> applyFetchGraph(RootGraph<?> graph) { default Query<R> applyFetchGraph(@SuppressWarnings("rawtypes") RootGraph graph) {
return applyGraph( graph, GraphSemantic.FETCH ); return applyGraph( graph, GraphSemantic.FETCH );
} }
@ -96,7 +96,7 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
* {@link GraphSemantic#LOAD} as the semantic * {@link GraphSemantic#LOAD} as the semantic
*/ */
@SuppressWarnings("UnusedDeclaration") @SuppressWarnings("UnusedDeclaration")
default Query<R> applyLoadGraph(RootGraph<?> graph) { default Query<R> applyLoadGraph(@SuppressWarnings("rawtypes") RootGraph graph) {
return applyGraph( graph, GraphSemantic.LOAD ); return applyGraph( graph, GraphSemantic.LOAD );
} }
@ -541,7 +541,7 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
* *
* @return {@code this}, for method chaining * @return {@code this}, for method chaining
*/ */
Query<R> setParameterList(String name, Collection<?> values); Query<R> setParameterList(String name, @SuppressWarnings("rawtypes") Collection values);
/** /**
* Bind multiple values to a positional query parameter. The Hibernate type of the parameter is * Bind multiple values to a positional query parameter. The Hibernate type of the parameter is
@ -554,7 +554,7 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
* *
* @return {@code this}, for method chaining * @return {@code this}, for method chaining
*/ */
Query<R> setParameterList(int position, Collection<?> values); Query<R> setParameterList(int position, @SuppressWarnings("rawtypes") Collection values);
/** /**
* Bind multiple values to a named query parameter. The Hibernate type of the parameter is * Bind multiple values to a named query parameter. The Hibernate type of the parameter is
@ -650,7 +650,7 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
* *
* @return {@code this}, for method chaining * @return {@code this}, for method chaining
*/ */
Query<R> setParameterList(String name, Object[] values, AllowableParameterType<?> type); Query<R> setParameterList(String name, Object[] values, @SuppressWarnings("rawtypes") AllowableParameterType type);
/** /**
* Bind multiple values to a named query parameter. This is useful for binding * Bind multiple values to a named query parameter. This is useful for binding
@ -662,7 +662,7 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
* *
* @return {@code this}, for method chaining * @return {@code this}, for method chaining
*/ */
Query<R> setParameterList(int position, Object[] values, AllowableParameterType<?> type); Query<R> setParameterList(int position, Object[] values, @SuppressWarnings("rawtypes") AllowableParameterType type);
/** /**
* Bind multiple values to a named query parameter. The Hibernate type of the parameter is * Bind multiple values to a named query parameter. The Hibernate type of the parameter is
@ -710,7 +710,7 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
* *
* @return {@code this}, for method chaining * @return {@code this}, for method chaining
*/ */
Query<R> setProperties(Map<?,?> bean); Query<R> setProperties(@SuppressWarnings("rawtypes") Map bean);
/** /**
* @deprecated (since 5.2) Use {@link #setTupleTransformer} or {@link #setResultListTransformer} * @deprecated (since 5.2) Use {@link #setTupleTransformer} or {@link #setResultListTransformer}

View File

@ -11,16 +11,10 @@ import org.hibernate.sql.results.internal.RowTransformerTupleTransformerAdapter;
/** /**
* User hook for applying transformations of the query result tuples (the result "row"). * User hook for applying transformations of the query result tuples (the result "row").
* *
* Ultimately, gets wrapped in a * Ultimately, gets wrapped in a {@link RowTransformerTupleTransformerAdapter}
* {@link RowTransformerTupleTransformerAdapter}
* to adapt the TupleTransformer to the {@link org.hibernate.sql.results.spi.RowTransformer} * to adapt the TupleTransformer to the {@link org.hibernate.sql.results.spi.RowTransformer}
* contract, which is the thing actually used to process the results internally. * contract, which is the thing actually used to process the results internally.
* *
* Note that {@link JpaTupleTransformer} is a special sub-type applications may use
* to transform the row into a JPA {@link jakarta.persistence.Tuple}. JpaTupleTransformer is
* deprecated as it is much more appropriate (and simpler) to simply specify the Query
* return type as Tuple
*
* @see org.hibernate.transform.ResultTransformer * @see org.hibernate.transform.ResultTransformer
* @see org.hibernate.sql.results.spi.RowTransformer * @see org.hibernate.sql.results.spi.RowTransformer
* *

View File

@ -383,6 +383,7 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
return hints; return hints;
} }
@SuppressWarnings("deprecation")
protected void collectHints(Map<String, Object> hints) { protected void collectHints(Map<String, Object> hints) {
if ( getQueryOptions().getTimeout() != null ) { if ( getQueryOptions().getTimeout() != null ) {
hints.put( HINT_TIMEOUT, getQueryOptions().getTimeout() ); hints.put( HINT_TIMEOUT, getQueryOptions().getTimeout() );
@ -445,7 +446,7 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
} }
} }
@Override @Override @SuppressWarnings("deprecation")
public QueryImplementor<R> setHint(String hintName, Object value) { public QueryImplementor<R> setHint(String hintName, Object value) {
getSession().checkOpen( true ); getSession().checkOpen( true );
@ -532,7 +533,6 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
DEPRECATION_LOGGER.deprecatedSetting( HINT_FETCHGRAPH, JAKARTA_HINT_FETCH_GRAPH ); DEPRECATION_LOGGER.deprecatedSetting( HINT_FETCHGRAPH, JAKARTA_HINT_FETCH_GRAPH );
} }
else { else {
assert HINT_LOADGRAPH.equals( hintName );
DEPRECATION_LOGGER.deprecatedSetting( HINT_FETCHGRAPH, JAKARTA_HINT_FETCH_GRAPH ); DEPRECATION_LOGGER.deprecatedSetting( HINT_FETCHGRAPH, JAKARTA_HINT_FETCH_GRAPH );
} }
@ -712,8 +712,9 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
return true; return true;
} }
@SuppressWarnings( "UnusedReturnValue" ) @SuppressWarnings({"UnusedReturnValue", "deprecation"})
protected boolean applyHibernateLockModeHint(LockMode lockMode) { protected boolean applyHibernateLockModeHint(LockMode lockMode) {
//TODO: this method is a noop. Delete it?
final LockOptions lockOptions; final LockOptions lockOptions;
if ( lockMode == LockMode.NONE ) { if ( lockMode == LockMode.NONE ) {
lockOptions = NONE; lockOptions = NONE;
@ -982,6 +983,7 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
locateBinding( parameter ).setBindValue( null, type ); locateBinding( parameter ).setBindValue( null, type );
} }
else if ( value instanceof Collection ) { else if ( value instanceof Collection ) {
//TODO: this looks wrong to me: how can value be both a P and a (Collection<P>)?
locateBinding( parameter ).setBindValues( (Collection<P>) value ); locateBinding( parameter ).setBindValues( (Collection<P>) value );
} }
else { else {
@ -1116,13 +1118,13 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
} }
@Override @Override
public QueryImplementor<R> setParameterList(String name, Collection<?> values) { public QueryImplementor<R> setParameterList(String name, @SuppressWarnings("rawtypes") Collection values) {
locateBinding( name ).setBindValues( values ); locateBinding( name ).setBindValues( values );
return this; return this;
} }
@Override @Override
public QueryImplementor<R> setParameterList(int position, Collection<?> values) { public QueryImplementor<R> setParameterList(int position, @SuppressWarnings("rawtypes") Collection values) {
locateBinding( position ).setBindValues( values ); locateBinding( position ).setBindValues( values );
return this; return this;
} }
@ -1151,15 +1153,15 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
return this; return this;
} }
@Override @Override @SuppressWarnings({"rawtypes", "unchecked"})
public QueryImplementor<R> setParameterList(String name, Object[] values, AllowableParameterType<?> type) { public QueryImplementor<R> setParameterList(String name, Object[] values, AllowableParameterType type) {
locateBinding( name ).setBindValues( Arrays.asList( values ), (AllowableParameterType<Object>) type ); locateBinding( name ).setBindValues( Arrays.asList( values ), type );
return this; return this;
} }
@Override @Override @SuppressWarnings({"rawtypes", "unchecked"})
public QueryImplementor<R> setParameterList(int position, Object[] values, AllowableParameterType<?> type) { public QueryImplementor<R> setParameterList(int position, Object[] values, AllowableParameterType type) {
locateBinding( position ).setBindValues( Arrays.asList( values ), (AllowableParameterType<Object>) type ); locateBinding( position ).setBindValues( Arrays.asList( values ), type );
return this; return this;
} }
@ -1288,7 +1290,7 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
return (T) binding.getBindValues(); return (T) binding.getBindValues();
} }
else { else {
return (T) binding.getBindValue(); return binding.getBindValue();
} }
} }
@ -1303,7 +1305,7 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
final QueryParameterBinding<?> binding = getQueryParameterBindings().getBinding( parameter ); final QueryParameterBinding<?> binding = getQueryParameterBindings().getBinding( parameter );
if ( binding == null || !binding.isBound() ) { if ( binding == null || !binding.isBound() ) {
throw new IllegalStateException( "Parameter value not yet bound : " + parameter.toString() ); throw new IllegalStateException( "Parameter value not yet bound : " + parameter );
} }
if ( binding.isMultiValued() ) { if ( binding.isMultiValued() ) {
@ -1342,10 +1344,10 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
private FlushMode sessionFlushMode; private FlushMode sessionFlushMode;
private CacheMode sessionCacheMode; private CacheMode sessionCacheMode;
protected void beforeQuery(boolean requiresTxn) { protected void beforeQuery() {
getQueryParameterBindings().validate(); getQueryParameterBindings().validate();
getSession().prepareForQueryExecution( requiresTxn ); getSession().prepareForQueryExecution(false);
prepareForExecution(); prepareForExecution();
@ -1412,7 +1414,7 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
} }
@Override @Override
public QueryImplementor<R> setProperties(Map<?,?> map) { public QueryImplementor<R> setProperties(@SuppressWarnings("rawtypes") Map map) {
for ( String paramName : getParameterMetadata().getNamedParameterNames() ) { for ( String paramName : getParameterMetadata().getNamedParameterNames() ) {
final Object object = map.get( paramName ); final Object object = map.get( paramName );
if ( object == null ) { if ( object == null ) {
@ -1421,15 +1423,14 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
} }
} }
else { else {
Class<?> retType = object.getClass(); if ( object instanceof Collection<?> ) {
if ( Collection.class.isAssignableFrom( retType ) ) { setParameterList( paramName, (Collection<?>) object );
setParameterList( paramName, (Collection) object );
} }
else if ( retType.isArray() ) { else if ( object instanceof Object[] ) {
setParameterList( paramName, (Object[]) object ); setParameterList( paramName, (Object[]) object );
} }
else { else {
setParameter( paramName, object, determineType( paramName, retType ) ); setParameter( paramName, object, determineType( paramName, object.getClass() ) );
} }
} }
} }
@ -1454,7 +1455,7 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
@Override @Override
public List<R> list() { public List<R> list() {
beforeQuery( false ); beforeQuery();
boolean success = false; boolean success = false;
try { try {
final List<R> result = doList(); final List<R> result = doList();
@ -1536,7 +1537,7 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
@Override @Override
public int executeUpdate() throws HibernateException { public int executeUpdate() throws HibernateException {
getSession().checkTransactionNeededForUpdateOperation( "Executing an update/delete query" ); getSession().checkTransactionNeededForUpdateOperation( "Executing an update/delete query" );
beforeQuery( false ); beforeQuery();
boolean success = false; boolean success = false;
try { try {
final int result = doExecuteUpdate(); final int result = doExecuteUpdate();

View File

@ -46,7 +46,6 @@ import org.hibernate.jpa.internal.util.LockModeTypeHelper;
import org.hibernate.jpa.spi.NativeQueryTupleTransformer; import org.hibernate.jpa.spi.NativeQueryTupleTransformer;
import org.hibernate.metamodel.model.domain.AllowableParameterType; import org.hibernate.metamodel.model.domain.AllowableParameterType;
import org.hibernate.metamodel.model.domain.BasicDomainType; import org.hibernate.metamodel.model.domain.BasicDomainType;
import org.hibernate.query.Limit;
import org.hibernate.query.NativeQuery; import org.hibernate.query.NativeQuery;
import org.hibernate.query.ParameterMetadata; import org.hibernate.query.ParameterMetadata;
import org.hibernate.query.Query; import org.hibernate.query.Query;
@ -127,7 +126,6 @@ public class NativeQueryImpl<R>
private Callback callback; private Callback callback;
private Object collectionKey; private Object collectionKey;
private NativeQueryInterpreter nativeQueryInterpreter;
/** /**
* Constructs a NativeQueryImpl given a sql query defined in the mappings. * Constructs a NativeQueryImpl given a sql query defined in the mappings.
@ -366,7 +364,7 @@ public class NativeQueryImpl<R>
.getService( NativeQueryInterpreter.class ) .getService( NativeQueryInterpreter.class )
.recognizeParameters( sqlString, parameterRecognizer ); .recognizeParameters( sqlString, parameterRecognizer );
return new ParameterInterpretationImpl( sqlString, parameterRecognizer ); return new ParameterInterpretationImpl( parameterRecognizer );
} }
); );
} }
@ -503,12 +501,12 @@ public class NativeQueryImpl<R>
} }
@Override @Override
public Query<R> applyGraph(RootGraph graph, GraphSemantic semantic) { public Query<R> applyGraph(@SuppressWarnings("rawtypes") RootGraph graph, GraphSemantic semantic) {
throw new HibernateException( "A native SQL query cannot use EntityGraphs" ); throw new HibernateException( "A native SQL query cannot use EntityGraphs" );
} }
@Override @Override
public NativeQueryImplementor<R> setTupleTransformer(TupleTransformer transformer) { public NativeQueryImplementor<R> setTupleTransformer(@SuppressWarnings("rawtypes") TupleTransformer transformer) {
return (NativeQueryImplementor<R>) super.setTupleTransformer( transformer ); return (NativeQueryImplementor<R>) super.setTupleTransformer( transformer );
} }
@ -565,9 +563,7 @@ public class NativeQueryImpl<R>
} }
if ( effectiveFlushMode == FlushMode.AUTO ) { if ( effectiveFlushMode == FlushMode.AUTO ) {
if ( getSession().getFactory().getSessionFactoryOptions().isJpaBootstrap() ) { return getSession().getFactory().getSessionFactoryOptions().isJpaBootstrap();
return true;
}
} }
} }
@ -594,7 +590,7 @@ public class NativeQueryImpl<R>
private NativeSelectQueryPlan<R> createQueryPlan(ResultSetMapping resultSetMapping) { private NativeSelectQueryPlan<R> createQueryPlan(ResultSetMapping resultSetMapping) {
final String sqlString = expandParameterLists(); final String sqlString = expandParameterLists();
final NativeSelectQueryDefinition<R> queryDefinition = new NativeSelectQueryDefinition<R>() { final NativeSelectQueryDefinition<R> queryDefinition = new NativeSelectQueryDefinition<>() {
@Override @Override
public String getSqlString() { public String getSqlString() {
return sqlString; return sqlString;
@ -788,10 +784,6 @@ public class NativeQueryImpl<R>
return !query.parameterBindings.hasAnyMultiValuedBindings(); return !query.parameterBindings.hasAnyMultiValuedBindings();
} }
private static boolean hasLimit(Limit limit) {
return limit.getFirstRow() != null || limit.getMaxRows() != null;
}
@Override @Override
public ScrollableResultsImplementor<R> scroll(ScrollMode scrollMode) { public ScrollableResultsImplementor<R> scroll(ScrollMode scrollMode) {
return resolveSelectQueryPlan().performScroll( scrollMode, this ); return resolveSelectQueryPlan().performScroll( scrollMode, this );
@ -834,7 +826,7 @@ public class NativeQueryImpl<R>
} }
@Override @Override
public NativeQueryImplementor setCollectionKey(Object key) { public NativeQueryImplementor<R> setCollectionKey(Object key) {
this.collectionKey = key; this.collectionKey = key;
return this; return this;
} }
@ -850,7 +842,7 @@ public class NativeQueryImpl<R>
} }
@Override @Override
public NativeQuery<R> addScalar(String columnAlias, BasicTypeReference<?> type) { public NativeQuery<R> addScalar(String columnAlias, @SuppressWarnings("rawtypes") BasicTypeReference type) {
return registerBuilder( return registerBuilder(
Builders.scalar( Builders.scalar(
columnAlias, columnAlias,
@ -860,12 +852,12 @@ public class NativeQueryImpl<R>
} }
@Override @Override
public NativeQueryImplementor<R> addScalar(String columnAlias, BasicDomainType<?> type) { public NativeQueryImplementor<R> addScalar(String columnAlias, @SuppressWarnings("rawtypes") BasicDomainType type) {
return registerBuilder( Builders.scalar( columnAlias, (BasicType<?>) type ) ); return registerBuilder( Builders.scalar( columnAlias, (BasicType<?>) type ) );
} }
@Override @Override
public NativeQueryImplementor<R> addScalar(String columnAlias, Class<?> javaType) { public NativeQueryImplementor<R> addScalar(String columnAlias, @SuppressWarnings("rawtypes") Class javaType) {
return registerBuilder( Builders.scalar( columnAlias, javaType, getSessionFactory() ) ); return registerBuilder( Builders.scalar( columnAlias, javaType, getSessionFactory() ) );
} }
@ -916,7 +908,7 @@ public class NativeQueryImpl<R>
@Override @Override
public NativeQueryImplementor<R> addAttributeResult( public NativeQueryImplementor<R> addAttributeResult(
String columnAlias, String columnAlias,
Class<?> entityJavaType, @SuppressWarnings("rawtypes") Class entityJavaType,
String attributePath) { String attributePath) {
return addAttributeResult( columnAlias, entityJavaType.getName(), attributePath ); return addAttributeResult( columnAlias, entityJavaType.getName(), attributePath );
} }
@ -933,7 +925,7 @@ public class NativeQueryImpl<R>
@Override @Override
public NativeQueryImplementor<R> addAttributeResult( public NativeQueryImplementor<R> addAttributeResult(
String columnAlias, String columnAlias,
SingularAttribute<?, ?> attribute) { @SuppressWarnings("rawtypes") SingularAttribute attribute) {
registerBuilder( Builders.attributeResult( columnAlias, attribute ) ); registerBuilder( Builders.attributeResult( columnAlias, attribute ) );
return this; return this;
} }
@ -950,7 +942,7 @@ public class NativeQueryImpl<R>
} }
@Override @Override
public DynamicResultBuilderEntityStandard addRoot(String tableAlias, Class entityType) { public DynamicResultBuilderEntityStandard addRoot(String tableAlias, @SuppressWarnings("rawtypes") Class entityType) {
return addRoot( tableAlias, entityType.getName() ); return addRoot( tableAlias, entityType.getName() );
} }
@ -972,17 +964,17 @@ public class NativeQueryImpl<R>
} }
@Override @Override
public NativeQueryImplementor<R> addEntity(Class<?> entityType) { public NativeQueryImplementor<R> addEntity(@SuppressWarnings("rawtypes") Class entityType) {
return addEntity( entityType.getName() ); return addEntity( entityType.getName() );
} }
@Override @Override
public NativeQueryImplementor<R> addEntity(String tableAlias, Class<?> entityClass) { public NativeQueryImplementor<R> addEntity(String tableAlias, @SuppressWarnings("rawtypes") Class entityClass) {
return addEntity( tableAlias, entityClass.getName() ); return addEntity( tableAlias, entityClass.getName() );
} }
@Override @Override
public NativeQueryImplementor<R> addEntity(String tableAlias, Class<?> entityClass, LockMode lockMode) { public NativeQueryImplementor<R> addEntity(String tableAlias, @SuppressWarnings("rawtypes") Class entityClass, LockMode lockMode) {
return addEntity( tableAlias, entityClass.getName(), lockMode ); return addEntity( tableAlias, entityClass.getName(), lockMode );
} }
@ -1057,7 +1049,7 @@ public class NativeQueryImpl<R>
} }
@Override @Override
public NativeQueryImplementor<R> addSynchronizedEntityClass(Class<?> entityClass) throws MappingException { public NativeQueryImplementor<R> addSynchronizedEntityClass(@SuppressWarnings("rawtypes") Class entityClass) throws MappingException {
addQuerySpaces( getSession().getFactory().getMetamodel().entityPersister( entityClass.getName() ).getQuerySpaces() ); addQuerySpaces( getSession().getFactory().getMetamodel().entityPersister( entityClass.getName() ).getQuerySpaces() );
return this; return this;
} }
@ -1161,18 +1153,16 @@ public class NativeQueryImpl<R>
addSynchronizedQuerySpace( (String) value ); addSynchronizedQuerySpace( (String) value );
} }
else if ( value instanceof String[] ) { else if ( value instanceof String[] ) {
final String[] strings = (String[]) value; for (String string : (String[]) value) {
for ( int i = 0; i < strings.length; i++ ) { addSynchronizedQuerySpace(string);
addSynchronizedQuerySpace( strings[i] );
} }
} }
else if ( value instanceof Class ) { else if ( value instanceof Class ) {
addSynchronizedEntityClass( (Class<?>) value ); addSynchronizedEntityClass( (Class<?>) value );
} }
else if ( value instanceof Class[] ) { else if ( value instanceof Class[] ) {
final Class<?>[] classes = (Class<?>[]) value; for (Class<?> aClass : (Class<?>[]) value) {
for ( int i = 0; i < classes.length; i++ ) { addSynchronizedEntityClass(aClass);
addSynchronizedEntityClass( classes[i] );
} }
} }
else if ( value instanceof List ) { else if ( value instanceof List ) {
@ -1200,7 +1190,7 @@ public class NativeQueryImpl<R>
else if ( value instanceof LockModeType ) { else if ( value instanceof LockModeType ) {
applyLockModeTypeHint( (LockModeType) value ); applyLockModeTypeHint( (LockModeType) value );
} }
else if ( String.class.isInstance( value ) ) { else if ( value instanceof String ) {
applyHibernateLockModeHint( LockModeTypeHelper.interpretLockMode( value ) ); applyHibernateLockModeHint( LockModeTypeHelper.interpretLockMode( value ) );
} }
else { else {
@ -1315,19 +1305,25 @@ public class NativeQueryImpl<R>
} }
@Override @Override
public <P> NativeQueryImplementor<R> setParameterList(int position, Collection<? extends P> values, AllowableParameterType<P> type) { public <P> NativeQueryImplementor<R> setParameterList(
int position, Collection<? extends P> values,
AllowableParameterType<P> type) {
super.setParameterList( position, values, type ); super.setParameterList( position, values, type );
return this; return this;
} }
@Override @Override
public NativeQueryImplementor<R> setParameterList(String name, Object[] values, AllowableParameterType<?> type) { public NativeQueryImplementor<R> setParameterList(
String name, Object[] values,
@SuppressWarnings("rawtypes") AllowableParameterType type) {
super.setParameterList( name, values, type ); super.setParameterList( name, values, type );
return this; return this;
} }
@Override @Override
public NativeQueryImplementor<R> setParameterList(int position, Object[] values, AllowableParameterType<?> type) { public NativeQueryImplementor<R> setParameterList(
int position, Object[] values,
@SuppressWarnings("rawtypes") AllowableParameterType type) {
super.setParameterList( position, values, type ); super.setParameterList( position, values, type );
return this; return this;
} }
@ -1392,7 +1388,7 @@ public class NativeQueryImpl<R>
} }
@Override @Override
public NativeQueryImplementor<R> setParameterList(String name, Collection<?> values) { public NativeQueryImplementor<R> setParameterList(String name, @SuppressWarnings("rawtypes") Collection values) {
super.setParameterList( name, values ); super.setParameterList( name, values );
return this; return this;
} }
@ -1451,14 +1447,14 @@ public class NativeQueryImpl<R>
return this; return this;
} }
@Override @Override @SuppressWarnings("deprecation")
public NativeQueryImplementor<R> setResultTransformer(ResultTransformer transformer) { public NativeQueryImplementor<R> setResultTransformer(ResultTransformer transformer) {
super.setResultTransformer( transformer ); super.setResultTransformer( transformer );
return this; return this;
} }
@Override @Override
public NativeQueryImplementor<R> setProperties(Map<?,?> map) { public NativeQueryImplementor<R> setProperties(@SuppressWarnings("rawtypes") Map map) {
super.setProperties( map ); super.setProperties( map );
return this; return this;
} }
@ -1518,7 +1514,7 @@ public class NativeQueryImpl<R>
} }
@Override @Override
public NativeQueryImplementor<R> setParameterList(int position, Collection<?> values) { public NativeQueryImplementor<R> setParameterList(int position, @SuppressWarnings("rawtypes") Collection values) {
super.setParameterList( position, values ); super.setParameterList( position, values );
return this; return this;
} }
@ -1552,7 +1548,7 @@ public class NativeQueryImpl<R>
} }
@Override @Override
protected void applyEntityGraphQueryHint(String hintName, RootGraphImplementor entityGraph) { protected void applyEntityGraphQueryHint(String hintName, @SuppressWarnings("rawtypes") RootGraphImplementor entityGraph) {
throw new HibernateException( "A native SQL query cannot use EntityGraphs" ); throw new HibernateException( "A native SQL query cannot use EntityGraphs" );
} }
@ -1562,7 +1558,7 @@ public class NativeQueryImpl<R>
private final Map<Integer, QueryParameterImplementor<?>> positionalParameters; private final Map<Integer, QueryParameterImplementor<?>> positionalParameters;
private final Map<String, QueryParameterImplementor<?>> namedParameters; private final Map<String, QueryParameterImplementor<?>> namedParameters;
public ParameterInterpretationImpl(String sqlString, ParameterRecognizerImpl parameterRecognizer) { public ParameterInterpretationImpl(ParameterRecognizerImpl parameterRecognizer) {
this.sqlString = parameterRecognizer.getAdjustedSqlString(); this.sqlString = parameterRecognizer.getAdjustedSqlString();
this.parameterList = parameterRecognizer.getParameterList(); this.parameterList = parameterRecognizer.getParameterList();
this.positionalParameters = parameterRecognizer.getPositionalQueryParameters(); this.positionalParameters = parameterRecognizer.getPositionalQueryParameters();

View File

@ -43,7 +43,9 @@ import org.hibernate.type.BasicTypeReference;
*/ */
@Incubating @Incubating
public interface NativeQueryImplementor<R> extends QueryImplementor<R>, NativeQuery<R>, NameableQuery { public interface NativeQueryImplementor<R> extends QueryImplementor<R>, NativeQuery<R>, NameableQuery {
NativeQueryImplementor setCollectionKey(Object key);
//TODO: this method is no longer used. Can it be deleted?
NativeQueryImplementor<R> setCollectionKey(Object key);
@Override @Override
default LockOptions getLockOptions() { default LockOptions getLockOptions() {
@ -66,10 +68,10 @@ public interface NativeQueryImplementor<R> extends QueryImplementor<R>, NativeQu
NativeQueryImplementor<R> addScalar(String columnAlias); NativeQueryImplementor<R> addScalar(String columnAlias);
@Override @Override
NativeQueryImplementor<R> addScalar(String columnAlias, BasicDomainType<?> type); NativeQueryImplementor<R> addScalar(String columnAlias, @SuppressWarnings("rawtypes") BasicDomainType type);
@Override @Override
NativeQueryImplementor<R> addScalar(String columnAlias, Class<?> javaType); NativeQueryImplementor<R> addScalar(String columnAlias, @SuppressWarnings("rawtypes") Class javaType);
@Override @Override
<C> NativeQueryImplementor<R> addScalar(String columnAlias, Class<C> relationalJavaType, AttributeConverter<?,C> converter); <C> NativeQueryImplementor<R> addScalar(String columnAlias, Class<C> relationalJavaType, AttributeConverter<?,C> converter);
@ -88,13 +90,13 @@ public interface NativeQueryImplementor<R> extends QueryImplementor<R>, NativeQu
Class<? extends AttributeConverter<O, J>> converter); Class<? extends AttributeConverter<O, J>> converter);
@Override @Override
NativeQueryImplementor<R> addAttributeResult(String columnAlias, Class<?> entityJavaType, String attributePath); NativeQueryImplementor<R> addAttributeResult(String columnAlias, @SuppressWarnings("rawtypes") Class entityJavaType, String attributePath);
@Override @Override
NativeQueryImplementor<R> addAttributeResult(String columnAlias, String entityName, String attributePath); NativeQueryImplementor<R> addAttributeResult(String columnAlias, String entityName, String attributePath);
@Override @Override
NativeQueryImplementor<R> addAttributeResult(String columnAlias, SingularAttribute<?, ?> attribute); NativeQueryImplementor<R> addAttributeResult(String columnAlias, @SuppressWarnings("rawtypes") SingularAttribute attribute);
@Override @Override
DynamicResultBuilderEntityStandard addRoot(String tableAlias, String entityName); DynamicResultBuilderEntityStandard addRoot(String tableAlias, String entityName);
@ -109,13 +111,13 @@ public interface NativeQueryImplementor<R> extends QueryImplementor<R>, NativeQu
NativeQueryImplementor<R> addEntity(String tableAlias, String entityName, LockMode lockMode); NativeQueryImplementor<R> addEntity(String tableAlias, String entityName, LockMode lockMode);
@Override @Override
NativeQueryImplementor<R> addEntity(Class<?> entityType); NativeQueryImplementor<R> addEntity(@SuppressWarnings("rawtypes") Class entityType);
@Override @Override
NativeQueryImplementor<R> addEntity(String tableAlias, Class<?> entityType); NativeQueryImplementor<R> addEntity(String tableAlias, @SuppressWarnings("rawtypes") Class entityType);
@Override @Override
NativeQueryImplementor<R> addEntity(String tableAlias, Class<?> entityClass, LockMode lockMode); NativeQueryImplementor<R> addEntity(String tableAlias, @SuppressWarnings("rawtypes") Class entityClass, LockMode lockMode);
@Override @Override
NativeQueryImplementor<R> addJoin(String tableAlias, String path); NativeQueryImplementor<R> addJoin(String tableAlias, String path);
@ -136,7 +138,7 @@ public interface NativeQueryImplementor<R> extends QueryImplementor<R>, NativeQu
NativeQueryImplementor<R> addSynchronizedEntityName(String entityName) throws MappingException; NativeQueryImplementor<R> addSynchronizedEntityName(String entityName) throws MappingException;
@Override @Override
NativeQueryImplementor<R> addSynchronizedEntityClass(Class<?> entityClass) throws MappingException; NativeQueryImplementor<R> addSynchronizedEntityClass(@SuppressWarnings("rawtypes") Class entityClass) throws MappingException;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -253,7 +255,7 @@ public interface NativeQueryImplementor<R> extends QueryImplementor<R>, NativeQu
Collection<P> values); Collection<P> values);
@Override @Override
NativeQueryImplementor<R> setParameterList(String name, Collection<?> values); NativeQueryImplementor<R> setParameterList(String name, @SuppressWarnings("rawtypes") Collection values);
// @Override // @Override
// default NativeQueryImplementor<R> setParameterList(String name, Collection values, Type type) { // default NativeQueryImplementor<R> setParameterList(String name, Collection values, Type type) {
@ -269,7 +271,7 @@ public interface NativeQueryImplementor<R> extends QueryImplementor<R>, NativeQu
// } // }
@Override @Override
NativeQueryImplementor<R> setParameterList(String name, Object[] values, AllowableParameterType<?> type); NativeQueryImplementor<R> setParameterList(String name, Object[] values, @SuppressWarnings("rawtypes") AllowableParameterType type);
@Override @Override
NativeQueryImplementor<R> setParameterList(String name, Object[] values); NativeQueryImplementor<R> setParameterList(String name, Object[] values);
@ -278,7 +280,7 @@ public interface NativeQueryImplementor<R> extends QueryImplementor<R>, NativeQu
NativeQueryImplementor<R> setProperties(Object bean); NativeQueryImplementor<R> setProperties(Object bean);
@Override @Override
NativeQueryImplementor<R> setProperties(Map<?,?> bean); NativeQueryImplementor<R> setProperties(@SuppressWarnings("rawtypes") Map bean);
@Override @Override
NativeQueryImplementor<R> setParameter( NativeQueryImplementor<R> setParameter(
@ -314,7 +316,7 @@ public interface NativeQueryImplementor<R> extends QueryImplementor<R>, NativeQu
NativeQueryImplementor<R> setParameter(String name, Instant value, TemporalType temporalType); NativeQueryImplementor<R> setParameter(String name, Instant value, TemporalType temporalType);
@Override @Override
NativeQueryImplementor<R> setTupleTransformer(TupleTransformer transformer); NativeQueryImplementor<R> setTupleTransformer(@SuppressWarnings("rawtypes") TupleTransformer transformer);
@Override @Override
NativeQueryImplementor<R> setResultListTransformer(ResultListTransformer transformer); NativeQueryImplementor<R> setResultListTransformer(ResultListTransformer transformer);
@ -353,7 +355,7 @@ public interface NativeQueryImplementor<R> extends QueryImplementor<R>, NativeQu
NativeQueryImplementor<R> setParameter(Parameter<OffsetDateTime> param, OffsetDateTime value, TemporalType temporalType); NativeQueryImplementor<R> setParameter(Parameter<OffsetDateTime> param, OffsetDateTime value, TemporalType temporalType);
@Override @Override
NativeQueryImplementor<R> setParameterList(int position, Collection<?> values); NativeQueryImplementor<R> setParameterList(int position, @SuppressWarnings("rawtypes") Collection values);
@Override @Override
<P> NativeQueryImplementor<R> setParameterList(String name, Collection<? extends P> values, Class<P> type); <P> NativeQueryImplementor<R> setParameterList(String name, Collection<? extends P> values, Class<P> type);
@ -371,7 +373,7 @@ public interface NativeQueryImplementor<R> extends QueryImplementor<R>, NativeQu
// NativeQueryImplementor<R> setParameterList(int position, Object[] values, Type type); // NativeQueryImplementor<R> setParameterList(int position, Object[] values, Type type);
@Override @Override
NativeQueryImplementor<R> setParameterList(int position, Object[] values, AllowableParameterType<?> type); NativeQueryImplementor<R> setParameterList(int position, Object[] values, @SuppressWarnings("rawtypes") AllowableParameterType type);
@Override @Override
NativeQueryImplementor<R> setParameterList(int position, Object[] values); NativeQueryImplementor<R> setParameterList(int position, Object[] values);

View File

@ -541,13 +541,13 @@ public class QuerySqmImpl<R>
} }
@Override @Override
public HqlQueryImplementor<R> applyGraph(RootGraph graph, GraphSemantic semantic) { public HqlQueryImplementor<R> applyGraph(@SuppressWarnings("rawtypes") RootGraph graph, GraphSemantic semantic) {
queryOptions.applyGraph( (RootGraphImplementor<?>) graph, semantic ); queryOptions.applyGraph( (RootGraphImplementor<?>) graph, semantic );
return this; return this;
} }
@Override @Override
protected void applyEntityGraphQueryHint(String hintName, RootGraphImplementor entityGraph) { protected void applyEntityGraphQueryHint(String hintName, @SuppressWarnings("rawtypes") RootGraphImplementor entityGraph) {
final GraphSemantic graphSemantic = GraphSemantic.fromJpaHintName( hintName ); final GraphSemantic graphSemantic = GraphSemantic.fromJpaHintName( hintName );
applyGraph( entityGraph, graphSemantic ); applyGraph( entityGraph, graphSemantic );