a1424132610 commented on issue #25685:
URL: 
https://github.com/apache/shardingsphere/issues/25685#issuecomment-1548852113

   ```yml
   spring:
     shardingsphere:
       datasource:
         names: ds1,ds2
         ds1:
           ...
         ds2:
           ...
       rules:
         sharding:
           tables:
             t_order:
               actual-data-nodes: ds1.t_order
               table-strategy:
                 none:
               data-strategy:
                 none:
             t_order_item:
               actual-data-nodes: ds2.t_order_item
               table-strategy:
                 none:
               data-strategy:
                 none:
     props:
         sql-show: true
         sql-federation-enabled: true
   ```
   
   ```text
   2023-05-16 09:53:36.408  INFO 24632 --- [           main] ShardingSphere-SQL 
                      : Logic SQL: select o.id, o.user_name, i.order_desc
                from t_order o inner join t_order_item i on o.order_id = 
i.order_id order by o.id desc limit 1
   2023-05-16 09:53:36.408  INFO 24632 --- [           main] ShardingSphere-SQL 
                      : SQLStatement: 
MySQLSelectStatement(table=Optional.empty, 
limit=Optional[org.apache.shardingsphere.sql.parser.sql.common.segment.dml.pagination.limit.LimitSegment@72426ced],
 lock=Optional.empty, window=Optional.empty)
   2023-05-16 09:53:36.408  INFO 24632 --- [           main] ShardingSphere-SQL 
                      : Actual SQL: ds1 ::: select o.id, o.user_name, 
i.order_desc
                from t_order o inner join t_order_item i on o.order_id = 
i.order_id order by o.id desc limit 1
   
   org.springframework.jdbc.BadSqlGrammarException: 
   Error querying database.  Cause: java.sql.SQLSyntaxErrorException: Table 
'test1.t_order_item' doesn't exist
   The error may exist in file 
[E:\my-study-project\sharding-sphere\target\classes\mapper\OrderMapper.xml]
   The error may involve defaultParameterMap
   The error occurred while setting parameters
   SQL: select o.id, o.user_name, i.order_desc   from t_order o inner join 
t_order_item i on o.order_id = i.order_id order by o.id desc limit 1
   Cause: java.sql.SQLSyntaxErrorException: Table 'test1.t_order_item' doesn't 
exist
   ; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: 
Table 'test1.t_order_item' doesn't exist
   
        at 
org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:234)
        at 
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
        at 
org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
        at 
org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
        at com.sun.proxy.$Proxy216.selectList(Unknown Source)
        at 
org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:224)
        at 
com.baomidou.mybatisplus.core.override.MybatisMapperMethod.executeForIPage(MybatisMapperMethod.java:121)
        at 
com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:85)
        at 
com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:148)
        at 
com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89)
        at com.sun.proxy.$Proxy219.listByPage(Unknown Source)
        at com.zhj.AppTest.test_order(AppTest.java:69)
        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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at 
org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
        at 
org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
        at 
org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
        at 
org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
        at 
org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at 
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
        at 
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at 
org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
        at 
org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at 
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at 
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
        at 
com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
        at 
com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
        at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
   Caused by: java.sql.SQLSyntaxErrorException: Table 'test1.t_order_item' 
doesn't exist
   ```
   
   ```sql
   select o.id, o.user_name, i.order_desc from t_order o inner join 
t_order_item i on o.order_id = i.order_id order by o.id desc limit 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]

Reply via email to