-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
for: external-projectFor an external project and not something we can fixFor an external project and not something we can fixstatus: invalidAn issue that we don't feel is validAn issue that we don't feel is valid
Description
After Spring Boot migration from 2.5.14 to 2.6 (or 2.7), this error started to show when i try to save some related entities to database:
Caused by: org.springframework.orm.jpa.JpaSystemException: Error accessing field [protected java.lang.Long com.example.datajpaerror.entity.DocumentEntityId.personId] by reflection for persistent property [com.example.datajpaerror.entity.DocumentEntityId#personId] : 1; nested exception is org.hibernate.property.access.spi.PropertyAccessException: Error accessing field [protected java.lang.Long com.example.datajpaerror.entity.DocumentEntityId.personId] by reflection for persistent property [com.example.datajpaerror.entity.DocumentEntityId#personId] : 1
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:331) ~[spring-orm-5.3.20.jar:5.3.20]
...
Caused by: org.hibernate.property.access.spi.PropertyAccessException: Error accessing field [protected java.lang.Long com.example.datajpaerror.entity.DocumentEntityId.personId] by reflection for persistent property [com.example.datajpaerror.entity.DocumentEntityId#personId] : 1
at org.hibernate.property.access.spi.GetterFieldImpl.get(GetterFieldImpl.java:75) ~[hibernate-core-5.6.9.Final.jar:5.6.9.Final]
...
Caused by: java.lang.IllegalArgumentException: Can not set java.lang.Long field com.example.datajpaerror.entity.DocumentEntityId.personId to java.lang.Long
at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) ~[na:na]
Since i'm using a quite complex Entity mapping configuration that involves inheritance and multi-column Primary Keys with EmbeddedId, i've wrote a small application in order to reproduce this error. The application can be found at https://github.com/ftsuda-senac/data-jpa-error
Steps to reproduce the error:
After downloading the application mentioned above, run as mvn test
A successful test can be achieved changing the Spring Boot version to 2.5.14 and running the same command mvn test
Metadata
Metadata
Assignees
Labels
for: external-projectFor an external project and not something we can fixFor an external project and not something we can fixstatus: invalidAn issue that we don't feel is validAn issue that we don't feel is valid