-
Notifications
You must be signed in to change notification settings - Fork 562
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
NPE in PersistentEntityJackson2Module toModule() [DATAREST-1592] #1947
Comments
I'm having the same issue and I did some debug. At least in my case, the problem is caused by mixing transient non-entiy objects with enties and using a projection which has spel expressions. ResourceMetadata metadata = associations.getMetadataFor(value.getTargetClass()); metadata is null because the value is not persistent, and therefore Links links = metadata.isExported() ? collector.getLinksFor(target) : Links.NONE; Throws an NPE. I tried pathcing that line as Links links = metadata != null && metadata.isExported() ? collector.getLinksFor(target) : Links.NONE; And all worked as expected. Attached is a demo project which reproduces the issue. |
Any ETA on this one? |
Would you be happy for me to raise a PR for this? |
@odrotbohm is there any chance this is goingt to be addressed? |
@odrotbohm thank you. Very much appreciated |
Daniele Renda opened DATAREST-1592 and commented
I've a Spring Projection as this:
I created a repository method to get a projection(DTO) bean instead of the entire bean:
and finally I've a
@RepositoryRestController
to expose that API:When I consume that API I've a NPE exception:
Affects: 3.4.2 (2020.0.2)
Attachments:
The text was updated successfully, but these errors were encountered: