持久層框架: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填充失敗。