lushunzhi opened a new issue #14495:
URL: https://github.com/apache/shardingsphere/issues/14495
## Bug Report
### Which version of ShardingSphere did you use?
- 4.1.0
- 4.1.1
- 5.0.0
```
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-jdbc-spring-boot-starter</artifactId>
<version>${shardingsphere}</version>
</dependency>
```
### Expected behavior
normal operation
### Actual behavior
Hibernate: select ? from gxm_company_attendance_report_record
04-01-2022 11:33:34.578 [main] TRACE
o.h.type.descriptor.sql.BasicBinder.bind - binding parameter [1] as [VARCHAR] -
[atc_1]
java.lang.ClassCastException:
org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.simple.ParameterMarkerExpressionSegment
cannot be cast to
org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.simple.LiteralExpressionSegment
at
org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.createProjection(MySQLDMLVisitor.java:467)
at
org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitProjection(MySQLDMLVisitor.java:429)
at
org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitProjection(MySQLDMLVisitor.java:127)
at
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$ProjectionContext.accept(MySQLStatementParser.java:5370)
at
org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at
org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitProjections(MySQLDMLVisitor.java:405)
at
org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitProjections(MySQLDMLVisitor.java:127)
at
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$ProjectionsContext.accept(MySQLStatementParser.java:4865)
at
org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at
org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitSelectClause(MySQLDMLVisitor.java:324)
at
org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitSelectClause(MySQLDMLVisitor.java:127)
at
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$SelectClauseContext.accept(MySQLStatementParser.java:4551)
at
org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at
org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitUnionClause(MySQLDMLVisitor.java:317)
at
org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitUnionClause(MySQLDMLVisitor.java:127)
at
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$UnionClauseContext.accept(MySQLStatementParser.java:4446)
at
org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at
org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitSelect(MySQLDMLVisitor.java:309)
at
org.apache.shardingsphere.sql.parser.mysql.visitor.impl.MySQLDMLVisitor.visitSelect(MySQLDMLVisitor.java:127)
at
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser$SelectContext.accept(MySQLStatementParser.java:3098)
at
org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at
org.apache.shardingsphere.sql.parser.SQLParserEngine.parse0(SQLParserEngine.java:80)
at
org.apache.shardingsphere.sql.parser.SQLParserEngine.parse(SQLParserEngine.java:61)
at
org.apache.shardingsphere.underlying.route.DataNodeRouter.createRouteContext(DataNodeRouter.java:97)
at
org.apache.shardingsphere.underlying.route.DataNodeRouter.executeRoute(DataNodeRouter.java:89)
at
org.apache.shardingsphere.underlying.route.DataNodeRouter.route(DataNodeRouter.java:76)
at
org.apache.shardingsphere.underlying.pluggble.prepare.PreparedQueryPrepareEngine.route(PreparedQueryPrepareEngine.java:54)
at
org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.executeRoute(BasePrepareEngine.java:96)
at
org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.prepare(BasePrepareEngine.java:83)
at
org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.prepare(ShardingPreparedStatement.java:183)
at
org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.executeQuery(ShardingPreparedStatement.java:116)
at
org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:60)
at org.hibernate.loader.Loader.getResultSet(Loader.java:2167)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1930)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1892)
at org.hibernate.loader.Loader.doQuery(Loader.java:937)
at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:340)
at org.hibernate.loader.Loader.doList(Loader.java:2689)
at org.hibernate.loader.Loader.doList(Loader.java:2672)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2506)
at org.hibernate.loader.Loader.list(Loader.java:2501)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:338)
at
org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:2223)
at
org.hibernate.internal.AbstractSharedSessionContract.list(AbstractSharedSessionContract.java:1053)
at
org.hibernate.query.internal.NativeQueryImpl.doList(NativeQueryImpl.java:170)
at
org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1505)
at org.hibernate.query.Query.getResultList(Query.java:135)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:402)
at com.sun.proxy.$Proxy202.getResultList(Unknown Source)
at
org.springframework.data.jpa.repository.query.JpaQueryExecution$CollectionExecution.doExecute(JpaQueryExecution.java:129)
at
org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:91)
at
org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:136)
at
org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:125)
at
org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:605)
at
org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$invoke$3(RepositoryFactorySupport.java:595)
at
org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:595)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at
org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:59)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at
org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at
org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at
org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:135)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at
org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:61)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy174.findFieldValByColumn(Unknown Source)
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule
configuration, when exception occur etc.
Hibernate: select ? from gxm_company_attendance_report_record
04-01-2022 11:33:34.578 [main] TRACE
o.h.type.descriptor.sql.BasicBinder.bind - binding parameter [1] as [VARCHAR] -
[atc_1]
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]