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

使用JPA注解时批量插入数据空指针异常 #92

Closed
zisedk opened this issue Nov 30, 2023 · 4 comments
Closed

使用JPA注解时批量插入数据空指针异常 #92

zisedk opened this issue Nov 30, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@zisedk
Copy link

zisedk commented Nov 30, 2023

批量插入数据使用调用了

io.mybatis.provider.keysql.KeySqlMsCustomize

但是JPA解析主键 EntityColumn 未设置 afterSqlgenId 默认值都为 null

23

@abel533
Copy link
Contributor

abel533 commented Nov 30, 2023

看代码这俩默认值都不是空:

    /**
     * 主键策略2,优先级2:取主键的 SQL,当前SQL只能在 INSERT 语句执行后执行,如果想要在 INSERT 语句执行前执行,可以使用 {@link #genId()}
     */
    String afterSql() default "";

    /**
     * 主键策略3,优先级3:Java 方式生成主键,可以和发号器一类的服务配合使用
     */
    Class<? extends GenId> genId() default GenId.NULL.class;

使用的最新版本吗?

@zisedk
Copy link
Author

zisedk commented Nov 30, 2023

你这个是 Entity.Column 中的值吧。但是我使用的是JPA解析的
默认的 EntityColumn 是没有给值的

3

@zisedk
Copy link
Author

zisedk commented Nov 30, 2023

JpaEntityColumnFactory 中解析 EntityColumn 没有对这2个值进行赋值,然后 EntityColumn 中的是没有默认值的

@abel533
Copy link
Contributor

abel533 commented Dec 1, 2023

这儿是bug

@abel533 abel533 added the bug Something isn't working label Dec 1, 2023
@abel533 abel533 closed this as completed in afa024c Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants