AssertionError when updating entity with lazy loading property and bytecode enhancement
Description
Repository to reproduce this issue: . Run test DemoSpringJpaApplicationTests.
I have a Spring Boot project with JPA, flyway, and postgresql. When I have a combination of inheritance and lazy loading in my entities, I encounter the following error when performing an update.
This happens when modifying a property in a child entity but not modifying any property in the parent entity. The parent entity needs to have at least one lazy loaded property for the error to appear.
I debugged and tracked down the issue to how UpdateCoordinatorStandard populates tablesNeedingUpdate and tablesNeedingDynamicUpdate. I believe there’s a bug in how tables of an inheritance hierarchy are added to tablesNeedingUpdate.
In my example, when updating a property in A320 (which inherits from Plane), tablesNeedingDynamicUpdate will contain both table mappings, but tablesNeedingUpdate only contains A320 in this part:
The only workaround at the moment is removing any lazy loaded properties to avoid a dynamic update.
Repository to reproduce this issue: . Run test
DemoSpringJpaApplicationTests
.I have a Spring Boot project with JPA, flyway, and postgresql. When I have a combination of inheritance and lazy loading in my entities, I encounter the following error when performing an update.
This happens when modifying a property in a child entity but not modifying any property in the parent entity. The parent entity needs to have at least one lazy loaded property for the error to appear.
I debugged and tracked down the issue to how
UpdateCoordinatorStandard
populatestablesNeedingUpdate
andtablesNeedingDynamicUpdate
. I believe there’s a bug in how tables of an inheritance hierarchy are added totablesNeedingUpdate
.In my example, when updating a property in
A320
(which inherits fromPlane
),tablesNeedingDynamicUpdate
will contain both table mappings, buttablesNeedingUpdate
only containsA320
in this part:The only workaround at the moment is removing any lazy loaded properties to avoid a dynamic update.