iblilife opened a new issue #8108:
URL: https://github.com/apache/shardingsphere/issues/8108
## Bug Report
### Which version of ShardingSphere did you use?
`org.apache.shardingsphere:sharding-jdbc-core:4.1.1`
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
### My code
Maven pom.xml
```xml
...
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-jdbc-core</artifactId>
<version>4.1.1</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.2</version>
</dependency>
...
```
MyBatis Mapper.xml
```xml
<select id="selectAll" resultType="map">
select #{name} AS rewriteName from table1 where name is null
</select>
```
### Actual behavior
Get the error
```text
org.mybatis.spring.MyBatisSystemException: nested exception is
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.ClassCastException: class
org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.simple.ParameterMarkerExpressionSegment
cannot be cast to class
org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.simple.LiteralExpressionSegment
(org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.simple.ParameterMarkerExpressionSegment
and
org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.simple.LiteralExpressionSegment
are in unnamed module of loader 'app')
### The error may exist in file [E:xxxx.xml]
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select ? AS rewriteName from table1 where name is null
### Cause: java.lang.ClassCastException: class
org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.simple.ParameterMarkerExpressionSegment
cannot be cast to class
org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.simple.LiteralExpressionSegment
(org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.simple.ParameterMarkerExpressionSegment
and
org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.simple.LiteralExpressionSegment
are in unnamed module of loader 'app')
at
org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:92)
at
org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:440)
at com.sun.proxy.$Proxy108.selectList(Unknown Source)
at
org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:223)
at
org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80)
at
org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:144)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)
at
com.sun.proxy.$Proxy176.fetchStandardCombinationAchievementSalesRuleList(Unknown
Source)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
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:139)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at
com.sun.proxy.$Proxy177.fetchStandardCombinationAchievementSalesRuleList(Unknown
Source)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]