加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

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

发布时间:2020-12-15 01:42:51 所属栏目:大数据 来源:网络整理
导读:有趣的问题,我传递一个int,并抱怨它不匹配类型: org.springframework.dao.InvalidDataAccessApiUsageException:参数值[0]与预期类型[java.lang.Integer]不匹配 @Procedure(procedureName = "dbo.do_cool_stuff_to_client")void coolClientStuff(int client

有趣的问题,我传递一个int,并抱怨它不匹配类型:

org.springframework.dao.InvalidDataAccessApiUsageException:参数值[0]与预期类型[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);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读