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.

Activity

Fixed

Details

Assignee

Reporter

Labels

Components

Sprint

Fix versions

Affects versions

Priority

Created January 10, 2024 at 1:09 AM
Updated January 18, 2024 at 1:38 PM
Resolved January 12, 2024 at 4:02 PM