HHH-11092 - NamedNativeQueries ordinal parameters are zero based
This commit is contained in:
parent
f8f5486fda
commit
30165d4aef
|
@ -151,7 +151,7 @@ public class HQLQueryPlan implements Serializable {
|
|||
}
|
||||
|
||||
public ParameterMetadataImpl getParameterMetadata() {
|
||||
return parameterMetadata;
|
||||
return parameterMetadata.getOrdinalParametersZeroBasedCopy();
|
||||
}
|
||||
|
||||
public ReturnMetadata getReturnMetadata() {
|
||||
|
|
|
@ -727,7 +727,9 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
|||
|
||||
@Override
|
||||
public QueryImplementor createNamedQuery(String name) {
|
||||
return buildQueryFromName( name, null );
|
||||
final QueryImplementor<Object> query = buildQueryFromName( name, null );
|
||||
query.getParameterMetadata().setOrdinalParametersZeroBased( false );
|
||||
return query;
|
||||
}
|
||||
|
||||
protected <T> QueryImplementor<T> buildQueryFromName(String name, Class<T> resultType) {
|
||||
|
|
|
@ -33,6 +33,14 @@ public class ParameterMetadataImpl implements ParameterMetadata {
|
|||
private final Map<String,NamedParameterDescriptor> namedDescriptorMap;
|
||||
private boolean isOrdinalParametersZeroBased = true;
|
||||
|
||||
private ParameterMetadataImpl(
|
||||
OrdinalParameterDescriptor[] ordinalDescriptors,
|
||||
Map<String, NamedParameterDescriptor> namedDescriptorMap, boolean isOrdinalParametersZeroBased) {
|
||||
this.ordinalDescriptors = ordinalDescriptors;
|
||||
this.namedDescriptorMap = namedDescriptorMap;
|
||||
this.isOrdinalParametersZeroBased = isOrdinalParametersZeroBased;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a ParameterMetadata container.
|
||||
*
|
||||
|
@ -252,4 +260,12 @@ public class ParameterMetadataImpl implements ParameterMetadata {
|
|||
public void setOrdinalParametersZeroBased(boolean isZeroBased) {
|
||||
this.isOrdinalParametersZeroBased = isZeroBased;
|
||||
}
|
||||
|
||||
public ParameterMetadataImpl getOrdinalParametersZeroBasedCopy() {
|
||||
return new ParameterMetadataImpl(
|
||||
this.ordinalDescriptors,
|
||||
this.namedDescriptorMap,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue