Skip to content

Inconsistent data retrieval on identical property names #2655

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
ddoppmeier opened this issue Jan 17, 2023 · 3 comments
Closed

Inconsistent data retrieval on identical property names #2655

ddoppmeier opened this issue Jan 17, 2023 · 3 comments
Assignees
Labels
type: bug A general bug

Comments

@ddoppmeier
Copy link

Hi everybody!

I have a problem, when property names on different classes are identical.
Sometimes the correct property values are retrieved from the db, sometimes they are not.
The content stored in the database seems to be ok each time.

Data model

A Company has multiple employees which are of type Person.
Person is subclassed by Developer and Sales.
Developer has two properties firstLanguage and secondLanguage, which both are of type ProgrammingLanguage.
Sales has two properties firstLanguage and secondLanguage, which are of type NatualLanguage

Use case

The small example application creates a company with one developer and one sales person.
Both employees have their languages set up accordingly.
The data is written to the db and then retrieved again.

Problem

In some cases, firstLanguage and secondLanguage are null for both persons.

The whole process (setup, store, retrieve) is executed in a loop.
If loading fails, it does so for all iterations.
If it is successfull, all iterations return correct results.
So the code behaves different for each application start.

Workaround

Using different property names seems to circumvent the problem, but might be difficult to maintain on growing data models.

Code

acme-corp.zip

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 17, 2023
@meistermeier meistermeier self-assigned this Jan 17, 2023
meistermeier added a commit that referenced this issue Jan 18, 2023
meistermeier added a commit that referenced this issue Jan 18, 2023
Don't exclude relationships only by their field name but also by their target entity.
meistermeier added a commit that referenced this issue Jan 18, 2023
If multiple base class extending entities contain the very same target,
it was reported as a cycle.
Now it will get correctly detected as a directed graph.
@meistermeier meistermeier added blocked: awaiting feedback and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 18, 2023
@meistermeier
Copy link
Collaborator

Thanks for reporting this.
This should be fixed now. At least you example runs with a 100% success rate 😄
Would be great to get your feedback on this (again).
The snapshot build is based on the 6.3. branch that you have currently also in your example.
If everything works for you, I am happy to merge it.

The version is 6.3.8-GH-2655-SNAPSHOT.

As a side-note: You might notice also that the querying now changed. Your example was also a great pointer on wrong detection of (non-existing) cycles in the provided domain. 👏

@ddoppmeier
Copy link
Author

I could not reproduce the original problem using the snapshot build.
Neither with the small example, nor with production code (which had a > 99% rate of failure).
So I guess it's fixed. 👍

@meistermeier
Copy link
Collaborator

Perfect, thanks for giving us feedback.

meistermeier added a commit that referenced this issue Jan 20, 2023
If multiple base class extending entities contain the very same target,
it was reported as a cycle.
Now it will get correctly detected as a directed graph.

Closes #2655
@meistermeier meistermeier added this to the 6.3.8 (2021.2.8) milestone Jan 20, 2023
meistermeier added a commit that referenced this issue Jan 20, 2023
Don't exclude relationships only by their field name but also by their target entity.
meistermeier added a commit that referenced this issue Jan 20, 2023
If multiple base class extending entities contain the very same target,
it was reported as a cycle.
Now it will get correctly detected as a directed graph.

Closes #2655
meistermeier added a commit that referenced this issue Jan 20, 2023
Don't exclude relationships only by their field name but also by their target entity.
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