You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're executing a query which may return a java.lang.Long or java.lang.Integer value. When calling Session.queryForObject we pass java.lang.Number as objectType.
The issue started occurring after upgrade from Spring Boot 2.1.5.RELEASE to 2.2.0.RELEASE.
It was introduced with commit 86f01ba.
Expected Behavior
Expectation is that super types of the actual result type can be used as result.
Current Behavior
The following exception is thrown from org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.queryForObject(ExecuteQueriesDelegate.java:97): org.neo4j.ogm.exception.core.MappingException: Cannot map java.lang.Long to java.lang.Number. This can be caused by missing registration of java.lang.Number.
Possible Solution
The bug seems to be in org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.queryForObject(ExecuteQueriesDelegate.java:88).
Current code: if (!next.getClass().isAssignableFrom(type)) {
Fix: if (!type.isAssignableFrom(next.getClass())) {
Your Environment
OGM Version used: 3.2.1
Java Version used: Oracle JDK 1.8.0_202
Neo4J Version used: 3.2.3
Bolt Driver Version used (if applicable): 3.2.1
Operating System and Version: macOS 10.14.6
The text was updated successfully, but these errors were encountered:
It would be great if there can be a version 3.2.2 soon so we can upgrade to spring boot 2.2.
On top of the tests in my pull request, I built the snapshot locally, overrode neo4j OGM version in our build and successfully verified that also our code seems to be working again.
… returned from the database.
- Fix check if result type is assignable to provided generic type
- Add test to verify result type compatibility check
This fixes#671.
Thanks for the report and also the fix, that is very much appreciated. I have also backported the test to 3.1.x, to ensure the desired behaviour there as well.
We'll see that we realize a patch in time for the Spring Boot 2.2.1 release which is due soon.
We're executing a query which may return a java.lang.Long or java.lang.Integer value. When calling Session.queryForObject we pass java.lang.Number as objectType.
The issue started occurring after upgrade from Spring Boot 2.1.5.RELEASE to 2.2.0.RELEASE.
It was introduced with commit 86f01ba.
Expected Behavior
Expectation is that super types of the actual result type can be used as result.
Current Behavior
The following exception is thrown from org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.queryForObject(ExecuteQueriesDelegate.java:97):
org.neo4j.ogm.exception.core.MappingException: Cannot map java.lang.Long to java.lang.Number. This can be caused by missing registration of java.lang.Number.
Possible Solution
The bug seems to be in org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.queryForObject(ExecuteQueriesDelegate.java:88).
Current code:
if (!next.getClass().isAssignableFrom(type)) {
Fix:
if (!type.isAssignableFrom(next.getClass())) {
Your Environment
The text was updated successfully, but these errors were encountered: