Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
spring-projects-issues opened this issue Mar 31, 2019 · 2 comments
Assignees
Labels
in: relational in: repository status: duplicate type: bug

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Mar 31, 2019

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

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Apr 9, 2019

Jens Schauder commented

Max Narvaes I can reproduce the issue on the 1.0.x branch, but it seems to be fixed on master. Could you verify this is fixed on 1.1.0.BUILD-SNAPSHOT?

Note that you might have to annotate the no-args-constructor of your entities with @PersistenceConstructor to avoid DATAJDBC-127

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Jun 11, 2019

Jens Schauder commented

This is probably a duplicate of DATAJDBC-223 and it is not feasible to backport that to 1.0.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: relational in: repository status: duplicate type: bug
Projects
None yet
Development

No branches or pull requests

2 participants