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填充失败。

原文地址:https://www.cnblogs.com/chenkeyu/p/14168724.html