Skip to content
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

EntityColumn 检测是否设置了主键策略异常 #97

Closed
zisedk opened this issue Feb 1, 2024 · 1 comment
Closed

EntityColumn 检测是否设置了主键策略异常 #97

zisedk opened this issue Feb 1, 2024 · 1 comment

Comments

@zisedk
Copy link

zisedk commented Feb 1, 2024

EntityColumn

  /**
   * 当前字段是否设置了主键策略
   */
  public boolean hasPrimaryKeyStrategy() {
    return id && (useGeneratedKeys || (afterSql != null && !afterSql.isEmpty()) || genId != GenId.NULL.class);
  }

使用JPA解析的时候 genId 没进行赋值就是 null ,这个地方校检的时候 返回当前有 主键策略
导致插入数据时在 KeySqlMsCustomize 不停地输出警告

方法 insertSelective 使用了 @Options(useGeneratedKeys = true),忽略实体上的主键策略
@abel533
Copy link
Contributor

abel533 commented Feb 1, 2024

来个PR?

abel533 added a commit to mybatis-mapper/provider that referenced this issue May 19, 2024
@abel533 abel533 closed this as completed May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants