Query.getParameter(int) is supposed to throw IllegalArgumentException in case no positional parameter is available. As of Hibernate 5.2, its implementation AbstractProducedQuery forwards to ParameterMetadata who's implementation in turn throws a Hibernate specific QueryParameterException from ParameterMetadataImpl.getNamedParameterDescriptor(String). |