-
Notifications
You must be signed in to change notification settings - Fork 162
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
Mapping Exception for entities with same Simple ClassName but different Labels #726
Comments
Thanks for reporting this. You are totally right with your finding and that this should not happen. A fix is on its way. |
meistermeier
added a commit
that referenced
this issue
Dec 20, 2019
With this change it is possible to have multiple classes with the same simple class name in the application's domain model. In cases when custom queries were created this failed because of a unnecessary guard. This fixes GH-726.
Cool. Thank you @meistermeier for your immediate fix. This should solve the issue. |
Thanks, @viggys for your report :) we will close the ticket as soon as the fix is on the relevant branches. |
meistermeier
added a commit
that referenced
this issue
Dec 20, 2019
With this change it is possible to have multiple classes with the same simple class name in the application's domain model. In cases when custom queries were created this failed because of a unnecessary guard. This fixes GH-726.
meistermeier
added a commit
that referenced
this issue
Dec 23, 2019
And don't use old parameter placeholders.
meistermeier
added a commit
that referenced
this issue
Dec 23, 2019
And don't use old parameter placeholders. (cherry picked from commit 81f1dd8)
meistermeier
added a commit
that referenced
this issue
Dec 23, 2019
With this change it is possible to have multiple classes with the same simple class name in the application's domain model. In cases when custom queries were created this failed because of a unnecessary guard.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have two entity classes with same SimpleName but in different packages and with different NodeEntity Labels. All the repository methods seem to work fine with both the classes, except for any repository method using @ Query annotation.
Facing OGM MappingException: More than one class has simple name.
This is happening as the class SimpleName is being used (in below code) to find the ClassInfo from session metadata, where actually the ClassInfo is mapped using either the NodeEntity Label or the Class FQN.
org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.lambda$executeAndMap$1(ExecuteQueriesDelegate.java:119)
session.metaData().classInfo(type.getSimpleName())
Expected Behavior
To find the mapping ClassInfo, execute and return the Query result.
Current Behavior
Facing below OGM Exception,
org.neo4j.ogm.exception.core.MappingException: More than one class has simple name
Possible Solution
Using Class FullQualifiedName instead of SimpleName ExecuteQueriesDelegate.executeAndMap to find the ClassInfo seems to work. Expecting suggestions on the fix.
Steps to Reproduce (for bugs)
Context
The goal is to use multiple node entity classes with same name but in different packages and work with the spring data repositories.
Your Environment
The text was updated successfully, but these errors were encountered: