spring data jdbc插入时报错:java.lang.IllegalArgumentException: After saving the identifier must not be null!


持久层框架:spring data jdbc

版本:2.1.2

报错:java.lang.IllegalArgumentException: After saving the identifier must not be null!

原因:

经过调试发现:

在spring在查找主键属性时(org.springframework.data.mapping.model.AnnotationBasedPersistentProperty#isId)只判断了属性是否有org.springframework.data.annotation.Id注解。

没有处理JPA中的注解javax.persistence.Id,如果使用此注解,会出现找不到主键的情况,造成id填充失败。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM