use of org.hibernate.param.PositionalParameterSpecification in project hibernate-orm by hibernate.
the class HqlSqlWalker method generatePositionalParameter.
@Override
protected AST generatePositionalParameter(AST delimiterNode, AST numberNode) throws SemanticException {
// todo : we check this multiple times
if (getSessionFactoryHelper().isStrictJPAQLComplianceEnabled() && namedParameters != null) {
throw new SemanticException("Cannot mix positional and named parameters: " + queryTranslatorImpl.getQueryString());
}
if (numberNode == null) {
throw new QueryException(String.format(Locale.ROOT, ERROR_LEGACY_ORDINAL_PARAMS_NO_LONGER_SUPPORTED, queryTranslatorImpl.getQueryString()));
}
final String positionString = numberNode.getText();
final int label = Integer.parseInt(positionString);
trackPositionalParameterPositions(label);
final ParameterNode parameter = (ParameterNode) astFactory.create(PARAM, positionString);
parameter.setText("?");
final int queryParamtersPosition = isFilter() ? label : label - 1;
final PositionalParameterSpecification paramSpec = new PositionalParameterSpecification(delimiterNode.getLine(), delimiterNode.getColumn(), label, queryParamtersPosition);
parameter.setHqlParameterSpecification(paramSpec);
parameterSpecs.add(paramSpec);
return parameter;
}
Aggregations