参数值[0]与预期类型[java.lang.Integer]不匹配

Kin*_*n2k 5 java spring stored-procedures jpa hql

有趣的问题,我正在传递intin并且它抱怨它不匹配类型:

org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [0] did not match expected type [java.lang.Integer]

@Procedure(procedureName = "dbo.do_cool_stuff_to_client")
void coolClientStuff(int clientId);
Run Code Online (Sandbox Code Playgroud)

它被称为如此:

public void someOtherMethod(int clientId){
  clientRepository.coolClientStuff(clientId);
}
Run Code Online (Sandbox Code Playgroud)

Kin*_*n2k 5

事实证明,它有些愚蠢/笨拙,它确实要我放入类类型而不是原始类型。

更改方法签名以使用Integer而不是int固定它。

@Procedure(procedureName = "dbo.do_cool_stuff_to_client")
void coolClientStuff(Integer clientId);
Run Code Online (Sandbox Code Playgroud)