forked from ebean-orm/ebean
-
Notifications
You must be signed in to change notification settings - Fork 0
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
NEW: MergeBeans function instead of updating existing bean from json #88
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rPraml
changed the title
FIX: update json with references
NEW: MergeBeans function instead of updating existing bean from json
May 12, 2023
rPraml
approved these changes
May 12, 2023
rPraml
added a commit
that referenced
this pull request
Aug 3, 2023
…88) Co-authored-by: Roland Praml <[email protected]>
rPraml
added a commit
that referenced
this pull request
Aug 3, 2023
…88) Co-authored-by: Roland Praml <[email protected]>
rPraml
added a commit
that referenced
this pull request
Aug 3, 2023
…88) Co-authored-by: Roland Praml <[email protected]>
rPraml
added a commit
that referenced
this pull request
Aug 8, 2023
…88) Co-authored-by: Roland Praml <[email protected]>
rPraml
added a commit
that referenced
this pull request
Aug 8, 2023
…88) Co-authored-by: Roland Praml <[email protected]>
rPraml
added a commit
that referenced
this pull request
Aug 9, 2023
…88) Co-authored-by: Roland Praml <[email protected]>
rPraml
added a commit
that referenced
this pull request
Aug 9, 2023
…88) Co-authored-by: Roland Praml <[email protected]>
rPraml
added a commit
that referenced
this pull request
Aug 9, 2023
…88) Co-authored-by: Roland Praml <[email protected]>
rPraml
added a commit
that referenced
this pull request
Aug 9, 2023
…88) Co-authored-by: Roland Praml <[email protected]>
rPraml
added a commit
that referenced
this pull request
Aug 9, 2023
…88) Co-authored-by: Roland Praml <[email protected]>
rPraml
pushed a commit
that referenced
this pull request
Aug 9, 2023
…88) Co-authored-by: Roland Praml <[email protected]> FIX: Merge of discriminator
rPraml
pushed a commit
that referenced
this pull request
Aug 9, 2023
…88) Co-authored-by: Roland Praml <[email protected]> FIX: Merge of discriminator FIX: Update reference (#89)
rPraml
pushed a commit
that referenced
this pull request
Aug 9, 2023
…88) Co-authored-by: Roland Praml <[email protected]> FIX: Merge of discriminator FIX: Update reference (#89)
rPraml
pushed a commit
that referenced
this pull request
Aug 9, 2023
…88) Co-authored-by: Roland Praml <[email protected]> FIX: Merge of discriminator FIX: Update reference (#89)
rPraml
pushed a commit
that referenced
this pull request
Aug 9, 2023
…88) Co-authored-by: Roland Praml <[email protected]> FIX: Merge of discriminator FIX: Update reference (#89)
rPraml
pushed a commit
that referenced
this pull request
Aug 9, 2023
…88) Co-authored-by: Roland Praml <[email protected]> FIX: Merge of discriminator FIX: Update reference (#89)
rPraml
pushed a commit
that referenced
this pull request
Aug 9, 2023
…88) Co-authored-by: Roland Praml <[email protected]> FIX: Merge of discriminator FIX: Update reference (#89)
rPraml
pushed a commit
that referenced
this pull request
Aug 9, 2023
…88) Co-authored-by: Roland Praml <[email protected]> FIX: Merge of discriminator FIX: Update reference (#89)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When updating complex object graphs with the existing
DB.toJson(existingBean, json)
this might fail, if you have cyclic references.Explanation
Ebean uses streaming when reading/writing jsons.
If you have a rather complex object graph with cycles, you may have problems when deserializing them.
As example take the class "User"
So your initial user could look like
If you serialize this, your JSON will look like
Serializion works fine, it stores just references. When it comes to deserialization, the following happens:
The more complex the json structure is, the more problems will appear.
This PR reverts the workarounds in ebean-orm#3000 (where we must buffer the json)
and mainly reverts ebean-orm#2617
(it will keep the API as deprecated)
It is recommeded now to do deserialize the JSON bean first and use Database.mergeBeans(jsonBean, targetBean)