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

Ignore missing entities when lazy loading is enabled with new Feature.WRITE_MISSING_ENTITIES_AS_NULL #126

Merged
merged 1 commit into from
Jan 25, 2019

Conversation

mobreza
Copy link

@mobreza mobreza commented Jan 23, 2019

This minor update gets around "Unable to find ... with id ..." of EntityNotFoundException when enable(Feature.WRITE_MISSING_ENTITIES_AS_NULL).

Fixes #125.

@cowtowncoder
Copy link
Member

In general I am not big fan of quietly swallowing exceptions, but since this is an opt-in feature covering a real use case that seems reasonable.

Just one request: looks like you only added this for hibernate4 module. Could you please do the same for hibernate5 as well? (hibernate3 is optional as far as I am concerned, may add if you want to, but it is not widely used).

@mobreza
Copy link
Author

mobreza commented Jan 23, 2019

@cowtowncoder Updated Hib5 module as requested, but as I only use 4, I have not tested it.

@mobreza
Copy link
Author

mobreza commented Jan 23, 2019

@cowtowncoder As usual, I need this in production yesterday 😄. Please let me know what I can do to make this happen.

@cowtowncoder
Copy link
Member

@mobreza Understandable :)

Thank you for adding hibernate5 part.

Now... on timing. You will probably need to compile and use local snapshot for one reason: even if I merge this soon (which I plan to), it will have to go in a minor release, adding new functionality.
But 2.10.0 is not ready to go yet at this point (actually neither would 2.9.9 be), so getting to pre-release / release candidate will take a while.

As to merging: would it be easy/possible to write a unit test to verify this functionality? I know there are tests that create in-memory database, run tests against Hibernate. But I don't know if testing this particular feature is feasible or not -- but would be great if it could.
If not, just let me know, I can merge this without test(s) if need be.

@mobreza
Copy link
Author

mobreza commented Jan 23, 2019

@cowtowncoder Added unit tests as requested.

- with `enable(Feature.WRITE_MISSING_ENTITIES_AS_NULL)`
@mobreza
Copy link
Author

mobreza commented Jan 23, 2019

@cowtowncoder Using space indentation.

@cowtowncoder cowtowncoder added this to the 2.10. milestone Jan 25, 2019
@cowtowncoder
Copy link
Member

Excellent! Thank you very much for doing this.

@cowtowncoder cowtowncoder merged commit 21ff609 into FasterXML:master Jan 25, 2019
@cowtowncoder cowtowncoder changed the title Ignore missing entities when lazy loading is enabled Ignore missing entities when lazy loading is enabled with new Feature.WRITE_MISSING_ENTITIES_AS_NULL Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants