Skip to content

One to many relashionship in aggregated child gets mapped incorrectly when retrieving it from database with spring-data-jdbc [DATAJDBC-348] #570

@spring-projects-issues

Description

@spring-projects-issues

Max Narvaes opened DATAJDBC-348 and commented

 have an aggregate that has a one to one relationship, and in the second level, the child entity has a one to many relationship (a List). Currently when the entity gets saved it does what is expected, and is saving it OK. But when I try to get the entity from the database the SQL that gets generated is wrong, resulting in an error. I cant really tell what Im missing here, any help will be greatly appreciated. Im using Lombok, spring-data-jdbc, and spring-boot. Maybe Lombok has something to do but I cant tell.

The problem is that when I save a new entity it does allright, but when I try to fetch it from the database the sql generated makes a join between the tables with a column "details" that exists in the entity but obviously its not part of the table.

If I put the list on the root aggregate the SQL generated and the mapping works fine.

GitHub project

https://github.com/maximilianonarvaes/spring-data-jdbc-demo


Affects: 1.0.5 (Lovelace SR5)

Reference URL: https://stackoverflow.com/questions/55383474/one-to-many-relashionship-in-aggregated-child-gets-mapped-incorrectly-when-retri

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions