Skip to content

fix: removed EntityManager.clear() from GraphQLJpaQueryDataFetcher #192

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

Merged
merged 2 commits into from
Sep 21, 2019

Conversation

igdianov
Copy link
Collaborator

@igdianov igdianov commented Sep 21, 2019

This PR removes calling EntityManager.clear() inside GraphQLJpaQueryDataFetcher.get() that causes runtime NPE in Hibernate in order to fix #191

The EntityManager.clear() has been added in this commit: 83c5a84 because of the mentioned problem: #96 (comment)

The provided test case cannot reproduce the issue anymore: 9e5002b

Calling clear method seems to be very invasive. There are already hints provided for Hibernate not to cache any results in memory:

Also, this problem could be still relevant in Hibernate versions before 5.3.10. The users may need to call EntityManager.clear() before execution of the query manually if needed.

@igdianov igdianov self-assigned this Sep 21, 2019
@igdianov igdianov added the bug label Sep 21, 2019
@codecov
Copy link

codecov bot commented Sep 21, 2019

Codecov Report

Merging #192 into master will increase coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #192      +/-   ##
============================================
+ Coverage     73.63%   73.68%   +0.04%     
- Complexity      873      874       +1     
============================================
  Files            50       50              
  Lines          3702     3701       -1     
  Branches        627      627              
============================================
+ Hits           2726     2727       +1     
+ Misses          697      696       -1     
+ Partials        279      278       -1
Impacted Files Coverage Δ Complexity Δ
.../query/schema/impl/GraphQLJpaQueryDataFetcher.java 92.47% <ø> (-0.09%) 26 <0> (ø)
.../graphql/jpa/query/introspection/Constructors.java 82% <0%> (+4%) 15% <0%> (+1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ce947d...9e5002b. Read the comment docs.

@igdianov igdianov merged commit ae25aba into master Sep 21, 2019
@igdianov igdianov deleted the igidianov-fix-entity-manager-npe branch September 21, 2019 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NullPointerException being thrown for unknown reason. No subsequent queries then succeed.
1 participant