From e9b8a80a99d2caee31345ef8943998054ec2e26b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Wed, 4 Jul 2018 09:36:18 +0200 Subject: [PATCH] HHH-12695 Rename org.hibernate.query.QueryParameter#getType to getHibernateType Because it conflicts with the Class-returning getType method we want to re-introduce in ParameterRegistration to restore backward compatibility. --- .../engine/query/spi/AbstractParameterDescriptor.java | 2 +- .../procedure/spi/ParameterRegistrationImplementor.java | 1 + .../src/main/java/org/hibernate/query/QueryParameter.java | 2 +- .../hibernate/query/internal/AbstractProducedQuery.java | 2 +- .../query/internal/QueryParameterBindingsImpl.java | 8 ++++---- .../org/hibernate/query/internal/QueryParameterImpl.java | 2 +- .../query/procedure/internal/ProcedureParameterImpl.java | 5 ----- 7 files changed, 9 insertions(+), 13 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/engine/query/spi/AbstractParameterDescriptor.java b/hibernate-core/src/main/java/org/hibernate/engine/query/spi/AbstractParameterDescriptor.java index 62e025b6df..df24844621 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/query/spi/AbstractParameterDescriptor.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/query/spi/AbstractParameterDescriptor.java @@ -42,7 +42,7 @@ public abstract class AbstractParameterDescriptor implements QueryParameter { } @Override - public Type getType() { + public Type getHibernateType() { return getExpectedType(); } diff --git a/hibernate-core/src/main/java/org/hibernate/procedure/spi/ParameterRegistrationImplementor.java b/hibernate-core/src/main/java/org/hibernate/procedure/spi/ParameterRegistrationImplementor.java index 6a5656660d..130cde2d20 100644 --- a/hibernate-core/src/main/java/org/hibernate/procedure/spi/ParameterRegistrationImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/procedure/spi/ParameterRegistrationImplementor.java @@ -34,6 +34,7 @@ public interface ParameterRegistrationImplementor extends ParameterRegistrati * * @return The Hibernate Type */ + @Override Type getHibernateType(); /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/QueryParameter.java b/hibernate-core/src/main/java/org/hibernate/query/QueryParameter.java index 25659e00a5..a947ae7dce 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/QueryParameter.java +++ b/hibernate-core/src/main/java/org/hibernate/query/QueryParameter.java @@ -21,7 +21,7 @@ public interface QueryParameter extends javax.persistence.Parameter { * * @return The Hibernate Type. */ - Type getType(); + Type getHibernateType(); int[] getSourceLocations(); diff --git a/hibernate-core/src/main/java/org/hibernate/query/internal/AbstractProducedQuery.java b/hibernate-core/src/main/java/org/hibernate/query/internal/AbstractProducedQuery.java index a16aca136a..847b5527de 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/internal/AbstractProducedQuery.java +++ b/hibernate-core/src/main/java/org/hibernate/query/internal/AbstractProducedQuery.java @@ -840,7 +840,7 @@ public abstract class AbstractProducedQuery implements QueryImplementor { protected Type determineType(String namedParam, Class retType) { Type type = getQueryParameterBindings().getBinding( namedParam ).getBindType(); if ( type == null ) { - type = getParameterMetadata().getQueryParameter( namedParam ).getType(); + type = getParameterMetadata().getQueryParameter( namedParam ).getHibernateType(); } if ( type == null ) { type = getProducer().getFactory().resolveParameterBindType( retType ); diff --git a/hibernate-core/src/main/java/org/hibernate/query/internal/QueryParameterBindingsImpl.java b/hibernate-core/src/main/java/org/hibernate/query/internal/QueryParameterBindingsImpl.java index 29bb9780eb..8badf415be 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/internal/QueryParameterBindingsImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/query/internal/QueryParameterBindingsImpl.java @@ -119,7 +119,7 @@ public class QueryParameterBindingsImpl implements QueryParameterBindings { ); } - final QueryParameterBinding binding = makeBinding( queryParameter.getType() ); + final QueryParameterBinding binding = makeBinding( queryParameter.getHibernateType() ); parameterBindingMap.put( queryParameter, binding ); return binding; @@ -145,7 +145,7 @@ public class QueryParameterBindingsImpl implements QueryParameterBindings { return parameterListBindingMap.computeIfAbsent( param, p -> new QueryParameterListBindingImpl( - param.getType(), + param.getHibernateType(), shouldValidateBindingValue() ) ); @@ -606,7 +606,7 @@ public class QueryParameterBindingsImpl implements QueryParameterBindings { syntheticParam = new NamedParameterDescriptor( syntheticName, - sourceParam.getType(), + sourceParam.getHibernateType(), sourceParam.getSourceLocations() ); } @@ -624,7 +624,7 @@ public class QueryParameterBindingsImpl implements QueryParameterBindings { syntheticParam = new OrdinalParameterDescriptor( syntheticPosition, syntheticPosition - jdbcStyleOrdinalCountBase, - sourceParam.getType(), + sourceParam.getHibernateType(), sourceParam.getSourceLocations() ); } diff --git a/hibernate-core/src/main/java/org/hibernate/query/internal/QueryParameterImpl.java b/hibernate-core/src/main/java/org/hibernate/query/internal/QueryParameterImpl.java index d7f1144b58..8ffa92f601 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/internal/QueryParameterImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/query/internal/QueryParameterImpl.java @@ -25,7 +25,7 @@ public abstract class QueryParameterImpl implements QueryParameter { } @Override - public Type getType() { + public Type getHibernateType() { return expectedType; } diff --git a/hibernate-core/src/main/java/org/hibernate/query/procedure/internal/ProcedureParameterImpl.java b/hibernate-core/src/main/java/org/hibernate/query/procedure/internal/ProcedureParameterImpl.java index 792ccc4466..63a4c0528d 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/procedure/internal/ProcedureParameterImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/query/procedure/internal/ProcedureParameterImpl.java @@ -118,11 +118,6 @@ public class ProcedureParameterImpl return position; } - @Override - public Type getHibernateType() { - return getType(); - } - @Override public void setHibernateType(Type expectedType) { super.setHibernateType( expectedType );