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

Blog 项目所遇到部分问题 #14

Open
zxy16305 opened this issue Feb 7, 2018 · 1 comment
Open

Blog 项目所遇到部分问题 #14

zxy16305 opened this issue Feb 7, 2018 · 1 comment
Labels

Comments

@zxy16305
Copy link
Owner

zxy16305 commented Feb 7, 2018

  1. JPA插入时提示值不能为空的问题
    在打开 spring boot 中的 application.properties 中加入配置: spring.jpa.show-sql=true,查看sql,果然插入了null值,使得数据库配置的默认值失效了。
    随后通过搜索引擎得知,在实体类上加入配置,@DynamicInsert、@DynamicUpdate ,使其忽略掉空值的注入即可
@zxy16305 zxy16305 added the Note label Feb 7, 2018
@zxy16305
Copy link
Owner Author

zxy16305 commented Feb 8, 2018

清空数据库(mysql)时需要用 TRUNCATE TABLE,这样主键也会重置

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant