From 6e5a4e63352454efe094f35be610f6caaa4fb1e6 Mon Sep 17 00:00:00 2001 From: Chris Cranford Date: Mon, 2 May 2016 14:36:05 -0500 Subject: [PATCH] Fix javadoc/comments to indicate ordinals are stored 0-based rather than 1-based. --- .../org/hibernate/query/internal/ParameterMetadataImpl.java | 4 ++-- .../hibernate/query/internal/QueryParameterBindingsImpl.java | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/query/internal/ParameterMetadataImpl.java b/hibernate-core/src/main/java/org/hibernate/query/internal/ParameterMetadataImpl.java index a28d6f51d6..1a17b914a3 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/internal/ParameterMetadataImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/query/internal/ParameterMetadataImpl.java @@ -109,7 +109,7 @@ public class ParameterMetadataImpl implements ParameterMetadata { /** * Get the descriptor for an ordinal parameter given its position * - * @param position The position (1 based) + * @param position The position (0 based) * * @return The ordinal parameter descriptor * @@ -119,7 +119,7 @@ public class ParameterMetadataImpl implements ParameterMetadata { if ( position < 0 || position >= ordinalDescriptors.length ) { throw new QueryParameterException( "Position beyond number of declared ordinal parameters. " + - "Remember that ordinal parameters are 1-based! Position: " + position + "Remember that ordinal parameters are 0-based! Position: " + position ); } return ordinalDescriptors[position]; 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 d71c9924aa..4a6c436a96 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 @@ -208,7 +208,6 @@ public class QueryParameterBindingsImpl implements QueryParameterBindings { if ( position < positionalParameterBindings.size() ) { binding = positionalParameterBindings.get( position ); if ( binding == null ) { - // metadata parameters are 1-based binding = makeBinding( parameterMetadata.getQueryParameter( position ) ); positionalParameterBindings.set( position, binding ); } @@ -217,7 +216,6 @@ public class QueryParameterBindingsImpl implements QueryParameterBindings { for ( int i = 0; i < position - positionalParameterBindings.size(); i++ ) { positionalParameterBindings.add( null ); } - // metadata parameters are 1-based QueryParameter queryParameter = parameterMetadata.getQueryParameter( position ); binding = makeBinding( queryParameter ); positionalParameterBindings.add( binding );