Skip to content

Relationships are not persisted when saving DTO objects as domain objects. #2475

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

Closed
scj7t4 opened this issue Feb 5, 2022 · 2 comments
Closed
Assignees
Labels
type: bug A general bug

Comments

@scj7t4
Copy link

scj7t4 commented Feb 5, 2022

Hello-

I am not sure this is a bug or if I'm not understanding/using projections correctly, so I do apologize if this is the expected behavior, but the docs are not clear if it is or not.

I am using:

SDN 6.2.1
Java 11.0.14

Reproduction:

Reproduction can be found here: in this repository, specifically this test

I have a CityModel which has several relationships to PersonModel objects. The city has a MAYOR, CITIZENS, and EMPLOYEE relations to people. I create a CityModel and PersonModel and persist them to the database. I then try to load the city Model as a projection (CityModelDTO) and connect it to a PersonModel by creating a PersonModelDTO instance and setting the id to match the previously persisted PersonModel. I then save CityModelDTO via Neo4jTemplate. If I then reload it as a CityModel none of the relationships I tried to save are present. Additionally the @Property("exotic.property") property is not updated as expected.

It is not in my reproduction, but I also tried to have a PersonModelRepository that could load the PersonModelDTO in case there was any secret sauce in the loaded DTO to help make the connection but got the same result.

What I expect to happen:

Persisting the DTO should create relationships to the existing nodes or create them with the projection properties if they do not exist. If this is not the intended behavior, I would expect to see warnings / errors in the console that the relationships will not be persisted.

What does happen:

No warnings or errors in the console but the relationships / property change are not persisted.

Thank you for your work on SDN :)

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 5, 2022
@michael-simons
Copy link
Collaborator

Could you please give the latest snapshot builds a try? This should be fixed #2371
however it might not work with dots in the (graph) properties.

@michael-simons michael-simons self-assigned this Feb 7, 2022
@michael-simons michael-simons added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 7, 2022
@michael-simons michael-simons added this to the 6.1.9 (2021.0.9) milestone Feb 7, 2022
@michael-simons
Copy link
Collaborator

Hi, same here: Thanks for the excellent report, a fix is on its way from 6.1 on upwards.

@michael-simons michael-simons changed the title Cannot Persist Relationships or Properties with periods (.) In DTO Objects Relationships are not persisted when saving DTO objects as domain objects. Feb 7, 2022
michael-simons added a commit that referenced this issue Feb 7, 2022
This is necessary so that all properties are actually filled before the entity is passed to the persister.

Fixes #2475
michael-simons added a commit that referenced this issue Feb 7, 2022
This is necessary so that all properties are actually filled before the entity is passed to the persister.

Fixes #2475
michael-simons added a commit that referenced this issue Feb 7, 2022
This is necessary so that all properties are actually filled before the entity is passed to the persister.

Fixes #2475
@michael-simons michael-simons mentioned this issue Jan 4, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants