banner
RustyNail

RustyNail

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

【CrudBoy's Wonderful Adventure】After running for a year, the code encountered an error: Invalid bound statement.

Code has been running for a year and encountered an error...

022-11-10 17:22:19.628 [http-nio-60051-exec-6] ERROR c.g.p.e.ExceptionProcessHandler - Invalid bound statement (not found): xx业务Mapper.selectBatchIds
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 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)

Original code

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

Possible reasons

1. The namespace in the mapper.xml is different from the actual class#

Checked and consistent

2. The function name in the mapper interface is different from the id in the mapper.xml tag#

selectBatchIds is the default method of com.baomidou.mybatisplus.core.mapper.BaseMapper<xx 业务>

Fixed code

@DS("xxxx")
public List<xx业务> getxx业务s(List<Long> uid) {
		return  xx业务Mapper.selectList(new LambdaQueryWrapper<xx业务>()
			.in(xx业务::getUid, uid)
	);
}
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.