I have tried using XML and @Select to construct SQL statements in mybatis, but errors still occur. From the error message, there is no problem with the constructed SQL syntax. This is what I am confused about.
dkpkMap: Map<Stirng, String>
select * from scloud_license_info
<where>
<foreach collection="dkpkMap.entrySet()" item="item" index="index"
open="(product_key, device_key) in (" separator="," close=")">
( #{index}, #{item} )
</foreach>
</where>
The above execution results are as follows:
### Error querying database. Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, please exclude the tableName or statementId.
Error SQL: SELECT * FROM scloud_license_info WHERE (product_key, device_key) IN ( (?, ?) )
### The error may exist in com/skyworthdigital/thirdpartyP2P/mapper/SCloudLicenseInfoMapper.java (best guess)
### The error may involve com.skyworthdigital.thirdpartyP2P.mapper.SCloudLicenseInfoMapper.batchUpdateDeviceOfflineTimeByPKDK
### The error occurred while executing a query
### Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, please exclude the tableName or statementId.
Error SQL: SELECT * FROM scloud_license_info WHERE (product_key, device_key) IN ( (?, ?) ); nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, please exclude the tableName or statementId.
Error SQL: SELECT * FROM scloud_license_info WHERE (product_key, device_key) IN ( (?, ?) )
### The error may exist in com/skyworthdigital/thirdpartyP2P/mapper/SCloudLicenseInfoMapper.java (best guess)
### The error may involve com.skyworthdigital.thirdpartyP2P.mapper.SCloudLicenseInfoMapper.batchUpdateDeviceOfflineTimeByPKDK
### The error occurred while executing a query
### Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, please exclude the tableName or statementId.
Error SQL: SELECT * FROM scloud_license_info WHERE (product_key, device_key) IN ( (?, ?) )
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.decorateException(KafkaMessageListenerContainer.java:1324)
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeBatchErrorHandler(KafkaMessageListenerContainer.java:1106)
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeBatchListener(KafkaMessageListenerContainer.java:1036)
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeBatchListener(KafkaMessageListenerContainer.java:949)
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeListener(KafkaMessageListenerContainer.java:932)
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.pollAndInvoke(KafkaMessageListenerContainer.java:751)
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.run(KafkaMessageListenerContainer.java:700)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java)
at java.lang.Thread.run(Thread.java:748)
New contributor
lingzhi wang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.