New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The primary key is sharding column created the key value by the GeneratedKey config 。 is it okay? #10274
Comments
|
no,I want to create the id by shardingsphere; the definition of User is okay. |
Follow step 1 ~ 2 |
it‘s okay. but i want to the value of the primary key created by the snowflake set by the sharding configuration. while step 1~2,the id is created by the mybatis-plus framework. |
How to confirm the id is created by the mybatis-plus framework? |
"IdType.AUTO" is created by the database,it will create by shardingsphere database middleware,mybatis-plus do nothing. |
it's okay. I try it. it's fine. I know the "IdType.ASSIGN_ID" procedure. But I don't really try the "IdType.AUTO". thank you |
table:
@TableName("t_user")
@DaTa
public class User implements Serializable {
}
config
sharding:
tables:
t_user:
actual-data-nodes: skshardingjdbc.t_user_$->{0..1}
logicTable: t_user
tableStrategy:
inline:
shardingColumn: id
algorithmExpression: t_user_$->{id % 2}
keyGenerator:
type: UUID
column: id
error
SQL: INSERT INTO t_user ( id, name, gmt_create, gmt_modified, phone ) VALUES ( ?, ?, ?, ?, ? )
Cause: java.lang.IllegalArgumentException: Sharding value must implements Comparable.
The text was updated successfully, but these errors were encountered: