Skip to content

NamedStoredProcedureQuery: Cannot resolve named output with no input parameters #2188

Closed as not planned
@HVollmilch

Description

@HVollmilch

Hi there!

I'm not quite sure, but i think i experience an issue using NamedStoredProcedureQuery, calling stored procedures that only have output but no input parameters.

I follwed the example of [DATAJPA-707], defining a NamedStoredProcedureQuery on my Entity

@NamedStoredProcedureQuery(
	name = "MyEntity.example", procedureName = "example",
	parameters = {
		@StoredProcedureParameter(mode = ParameterMode.OUT, name = "example1", type = Integer.class),
		@StoredProcedureParameter(mode = ParameterMode.OUT, name = "example2", type = Integer.class)
	})

Referencing it in my Repository

@Procedure(procedureName = "MyEntity.example")
Map<String, Integer> example(); 

When i call this method at runtime, I get an exception:

 Positional parameter [1] is not registered with this procedure call   (ProcedureParameterMetadata:141)

Climbing up the stack, it seems that useNamedParameters of StoredProcedureJpaQuery is set to false. This is calclulated on startup and is false, because my Repository method has no (named input) parameters. If i set useNamedParameters to true using the debugger, my procedure call works fine. So i guess there should be another option or logic behind this, but may i miss something or this is not an issue in current versions anymore .

Im using spring-data-jpa 2.3.1

Thanks!
Denis

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions