簡體   English   中英

參數值[0]與預期的類型[java.lang.Integer]不匹配

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM