You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/07/13 06:14:20 UTC

[GitHub] [shardingsphere] strongduanmu commented on issue #11299: "Cannot find strategy for generate keys." error when mybatis-plus save

strongduanmu commented on issue #11299:
URL: https://github.com/apache/shardingsphere/issues/11299#issuecomment-878809065


   @2241101100 Which table query triggered this exception? If the table cannot find the corresponding table rule, this exception will occur.
   
   ```java
       /**
        * Generate key.
        *
        * @param logicTableName logic table name
        * @return generated key
        */
       public Comparable<?> generateKey(final String logicTableName) {
           Optional<TableRule> tableRule = findTableRule(logicTableName);
           if (!tableRule.isPresent()) {
               throw new ShardingSphereConfigurationException("Cannot find strategy for generate keys.");
           }
           KeyGenerateAlgorithm keyGenerator = null != tableRule.get().getKeyGeneratorName() ? keyGenerators.get(tableRule.get().getKeyGeneratorName()) : defaultKeyGenerateAlgorithm;
           return keyGenerator.generateKey();
       }
   ```


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org