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