![](/img/trans.png)
[英]java.lang.IllegalArgumentException: Parameter value [1604438222] did not match expected type [java.lang.Integer (n/a)
[英]Parameter value [0] did not match expected type [java.lang.Integer]
一個有趣的問題,我傳入一個int
,並且抱怨它與類型不匹配:
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);
它被這樣稱呼:
public void someOtherMethod(int clientId){
clientRepository.coolClientStuff(clientId);
}
事實證明,它有些愚蠢/笨拙,它真的要我放入類類型而不是原始類型。
將方法簽名更改為使用Integer
而不是int
固定它。
@Procedure(procedureName = "dbo.do_cool_stuff_to_client")
void coolClientStuff(Integer clientId);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.