azraelee opened a new issue #11381:
URL: https://github.com/apache/shardingsphere/issues/11381


   ## Question
   
   I want to use the auto-incrementing primary key of the database for tables 
that are not in the sharding rule. How do I configure it?
   
   **The following is the error message:**
   
   Caused by: org.mybatis.spring.MyBatisSystemException: nested exception is 
org.apache.ibatis.exceptions.PersistenceException: 
    Error updating database.  Cause: 
org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException:
 Cannot find strategy for generate keys.
   The error may exist in file [MagicTipsMapper.xml]
   The error may involve 
la.kaike.mentalgrowth.dal.postbox.mapper.MagicTipsMapper.insertSelective-Inline
    The error occurred while setting parameters
   SQL: insert into emg_magic_tips          ( title,                            
               img,                                           jump_url,         
                                               sort )           values ( ?,     
                                      ?,                                        
   ?,                                                        ? )
   Cause: 
org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException:
 Cannot find strategy for generate keys.
   
   
   **Table Structure:**
   CREATE TABLE `emg_magic_tips` (
     `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
     `title` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '标题',
     `img` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '图片地址',
     `jump_url` varchar(1024) COLLATE utf8mb4_bin NOT NULL COMMENT '跳转链接',
     `click_volume` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '点击量',
     `sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序)',
     `creator` varchar(32) COLLATE utf8mb4_bin DEFAULT '' COMMENT '创建人',
     `create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
     `updator` varchar(32) COLLATE utf8mb4_bin DEFAULT '' COMMENT '修改人',
     `update_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE 
CURRENT_TIMESTAMP COMMENT '修改时间',
     `deleted` char(1) COLLATE utf8mb4_bin NOT NULL DEFAULT 'N' COMMENT 
'''N''-未删除、''Y''-已删除',
     PRIMARY KEY (`id`) USING BTREE
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
   


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