1 返回值为int类型 最好写 对象 Integer
即使线下测试成功 线上可能报错
org.springframework.aop.AopInvocationException:Null return value from advice does not match primitive return type for
2 spring boot spring data jpa
在配置文件 jpa 加上 如下
jpa:
database: MySQL
show-sql: true
hibernate:
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
否则即使你字段都映射对了
还是可能报错
大坑
3 项目上线后 报错
org.springframework.orm.jpa.JpaSystemException: ids for this class must be manually assigned before calling save():
加注解
@GeneratedValue(strategy = GenerationType.IDENTITY)
链接
https://blog.youkuaiyun.com/zsg88/article/details/79366268