Kimisme opened a new issue #8607:
URL: https://github.com/apache/shardingsphere/issues/8607


   Depend on the following
   
   ```
   <dependency>
       <groupId>com.oracle.database.jdbc</groupId>
       <artifactId>ojdbc8</artifactId>
       <version>12.2.0.1</version>
   </dependency>
   <dependency>
       <groupId>org.apache.shardingsphere</groupId>
       <artifactId>shardingsphere-jdbc-core</artifactId>
       <version>5.0.0-alpha</version>
   </dependency>
   ```
   
   **tb_student is a table that does not participate in sharding.**
   
   It can be executed normally (externally incoming ID) in the following ways.
   
   ```xml
   <insert id="insertOK" parameterType="Student">
       insert into TB_STUDENT(
            ID,
            CREATOR_ID,
            UPDATOR_ID,
       )
       values (
            #{id, jdbcType=DECIMAL},
            #{creatorId, jdbcType=DECIMAL},
            #{updatorId, jdbcType=DECIMAL},
       )
   </insert>
   ```
   
   
   Failed to execute in the following way (Mybatis auto-fetch).
   
   ```xml
   <insert id="insertFail" parameterType="Student">
       <selectKey resultType="long" keyProperty="id" order="BEFORE">
           select TB_STUDENT_SEQ.nextval from dual;
       </selectKey>
       insert into TB_STUDENT (
            ID,
            CREATOR_ID,
            UPDATOR_ID,
       )
       values (
            #{id, jdbcType=DECIMAL},
            #{creatorId, jdbcType=DECIMAL},
            #{updatorId, jdbcType=DECIMAL},
       )
   </insert>
   ```
   
   The error is as follows:
   
   ```
   Caused by: 
org.apache.shardingsphere.infra.exception.ShardingSphereException: Can not 
route tables for `[DUAL, TB_STUDENT_SEQ]`, please make sure the tables are in 
same schema.
        at 
org.apache.shardingsphere.sharding.route.engine.type.unconfigured.ShardingUnconfiguredTablesRoutingEngine.route(ShardingUnconfiguredTablesRoutingEngine.java:55)
        at 
org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:70)
        at 
org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:55)
        at 
org.apache.shardingsphere.infra.route.engine.impl.PartialSQLRouteExecutor.route(PartialSQLRouteExecutor.java:59)
        at 
org.apache.shardingsphere.infra.route.engine.SQLRouteEngine.route(SQLRouteEngine.java:57)
        at 
org.apache.shardingsphere.infra.context.kernel.KernelProcessor.generateExecutionContext(KernelProcessor.java:52)
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.createExecutionContext(ShardingSpherePreparedStatement.java:266)
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.execute(ShardingSpherePreparedStatement.java:198)
        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.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
        at com.sun.proxy.$Proxy29.execute(Unknown Source)
        at 
org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:62)
        at 
org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:78)
        at 
org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
        at 
org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:303)
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:154)
        at 
org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:102)
        at 
org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:82)
        at 
org.apache.ibatis.executor.keygen.SelectKeyGenerator.processGeneratedKeys(SelectKeyGenerator.java:68)
   ```
   
   By the way, I can't find the `RC version` in the Maven repository.
   
   
![image](https://user-images.githubusercontent.com/10137968/102041359-3aaddd00-3e0a-11eb-955e-e1ae26d3181d.png)
   


----------------------------------------------------------------
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]


Reply via email to