参数值 [0] 与预期类型 [java.lang.Integer] 不匹配
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31707504/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Parameter value [0] did not match expected type [java.lang.Integer]
提问by Kingpin2k
Fun issue where I'm passing an int
in and it's complaining about it not matching the type:
我传入一个有趣的问题,int
它抱怨它与类型不匹配:
org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [0] did not match expected type [java.lang.Integer]
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);
It's being called like so:
它被这样调用:
public void someOtherMethod(int clientId){
clientRepository.coolClientStuff(clientId);
}
回答by Kingpin2k
It turns out there is something stupid/funky with it, where it really wants me to put in the class type and not a primitive type.
事实证明它有一些愚蠢/时髦的东西,它真的希望我放入类类型而不是原始类型。
Changing the method signature to use Integer
instead of int
fixed it.
更改方法签名以使用Integer
而不是int
修复它。
@Procedure(procedureName = "dbo.do_cool_stuff_to_client")
void coolClientStuff(Integer clientId);