Keygenerators configured but not effective
See original GitHub issueWhich version of ShardingSphere did you use?
shardingsphere-jdbc-core-spring-boot-starter-5.1.2
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
shardingsphere-jdbc
Expected behavior
When inserting data into the database, sharding JDBC automatically generates the ID and successfully inserts it
Actual behavior
When inserting data in the databse, the system throw exception: Field 'id' doesn't have a default value
Reason analyze (If you can)
Maybe my configuration is not effective, but my configuration is based on the example
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
`server.port=8888
spring.main.allow-bean-definition-overriding=true
spring.application.name=sharding-sphere-demo
spring.shardingsphere.datasource.names=ds0
spring.shardingsphere.datasource.ds0.url=jdbc:mysql://192.168.20.177/sharding_demo?useSSL=false&serverTimezone=UTC
spring.shardingsphere.datasource.ds0.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.ds0.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.ds0.username=root
spring.shardingsphere.datasource.ds0.password=
spring.shardingsphere.mode.type=Memory
spring.shardingsphere.rules.sharding.binding-tables=admin_email
spring.shardingsphere.rules.sharding.sharding-algorithms.eat-auto-interval.type=auto_interval
spring.shardingsphere.rules.sharding.sharding-algorithms.eat-auto-interval.props.datetime-lower=2022-06-01 00:00:00
spring.shardingsphere.rules.sharding.sharding-algorithms.eat-auto-interval.props.datetime-upper=2022-09-01 00:00:00
spring.shardingsphere.rules.sharding.sharding-algorithms.eat-auto-interval.props.sharding-seconds=2592000
spring.shardingsphere.rules.sharding.auto-tables.admin_email.sharding-strategy.standard.sharding-column=created_at
spring.shardingsphere.rules.sharding.auto-tables.admin_email.sharding-strategy.standard.sharding-algorithm-name=eat-auto-interval
spring.shardingsphere.rules.sharding.auto-tables.admin_email.key-generate-strategy.column=id
spring.shardingsphere.rules.sharding.auto-tables.admin_email.key-generate-strategy.key-generator-name=snowflake
spring.shardingsphere.rules.sharding.auto-tables.admin_email.actualDataSources=ds0
spring.shardingsphere.rules.sharding.key-generators.snowflake.type=SNOWFLAKE
spring.shardingsphere.props.sql.show=true
mybatis.type-aliases-package=com.example.eatshardingsphere.admin.mapper
mybatis.mapper-locations=classpath:mapper/*.xml,classpath*:sdk/mapper/*.xml
mybatis.configuration.map-underscore-to-camel-case=true
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl `
My excute sql
insert into admin_email(email
, type
, created_at
) value (#{email.email}, #{email.type}, #{email.createdAt})
Example codes for reproduce this issue (such as a github link).
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Generating unique cache key with Spring KeyGenerator not ...
I'm having the issue when my cache keys are colliding in Spring using the @Cacheable annotation.
Read more >Servers won't work (AES Keygenerator not available) - Jira
I have deleted and re-installed Minecraft several times since servers stopped working, but nothing changes. Tried running different Minecraft ...
Read more >Spring Cache - Creating a Custom KeyGenerator - Baeldung
3. Custom KeyGenerator. If it isn't implemented or used correctly, it can lead to overwriting cache data. After that, we have two possible...
Read more >Apache Hudi Key Generators
Hudi provides several key generators out of the box that users can use based on their need, while having a pluggable implementation for...
Read more >KeyGenerator (Java Platform SE 8 ) - Oracle Help Center
Key generators are constructed using one of the getInstance class methods of ... In case the client does not explicitly initialize the KeyGenerator...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello , this issue has not received a reply for several days. This issue is supposed to be closed.
Sorry, this problem has been solved. it should be that I confused the configuration items of the old version and the new version