banner
RustyNail

RustyNail

coder. 【blog】https://rustynail.me 【nostr】wss://ts.relays.world/ wss://relays.world/nostr

【CrudBoyの奇妙な冒険】1年間実行していたコードがエラー「Invalid bound statement」を返しました。

走っていたコードがエラーを返しました...

022-11-10 17:22:19.628 [http-nio-60051-exec-6] ERROR c.g.p.e.ExceptionProcessHandler - 無効なバウンドステートメント(見つかりません):xx业务Mapper.selectBatchIds
org.apache.ibatis.binding.BindingException: 無効なバウンドステートメント(見つかりません):xx业务Mapper.selectBatchIds
	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:235)
	at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.<init>(MybatisMapperMethod.java:50)
	at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.lambda$cachedInvoker$0(MybatisMapperProxy.java:111)
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source)
	at com.baomidou.mybatisplus.core.toolkit.CollectionUtils.computeIfAbsent(CollectionUtils.java:115)
	at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.cachedInvoker(MybatisMapperProxy.java:98)
	at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89)
	at com.sun.proxy.$Proxy120.selectBatchIds(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at com.baomidou.dynamic.datasource.aop.DynamicDataSourceAnnotationInterceptor.invoke(DynamicDataSourceAnnotationInterceptor.java:50)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
	at com.sun.proxy.$Proxy121.selectBatchIds(Unknown Source)

元のコード

@DS("xxxx")
public List<xx业务> getxx业务s(List<Long> uid) {
	return xx业务Mapper.selectBatchIds(uid);
}

可能な原因

1. mapper.xml の namespace と実際のクラスが一致していない#

調査した結果、一致しています

2. mapper インターフェースの関数名と mapper.xml のタグ id が一致していない#

selectBatchIds は com.baomidou.mybatisplus.core.mapper.BaseMapper<xx 业务> のデフォルトメソッドです

修正されたコード

@DS("xxxx")
public List<xx业务> getxx业务s(List<Long> uid) {
		return xx业务Mapper.selectList(new LambdaQueryWrapper<xx业务>()
			.in(xx业务::getUid, uid)
	);
}
読み込み中...
文章は、創作者によって署名され、ブロックチェーンに安全に保存されています。