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

ogm mapping issue #1156

Open
isakovarseniy opened this issue Sep 5, 2024 · 1 comment
Open

ogm mapping issue #1156

isakovarseniy opened this issue Sep 5, 2024 · 1 comment

Comments

@isakovarseniy
Copy link

Expected Behavior

Current Behavior

Context

Your Environment

  • Java version: 17.0.9
  • Neo4j version (The version of the database): 5.20.0
  • OGM Version (The version of this software): 4.0.10
  • OGM Transport used (One of Bolt, HTTP or embedded):
  • Neo4j Java Driver version (in case of Bolt transport): bolt

I have following structure ( See archive ). During search operation

          1. Insert class Window. 
          2. Collection<?> result = session().loadAll( Canvas.class, filters, sortOrder, pager);

error occurred : Multiple classes found in type hierarchy that map to: [Canvas, UObject, Window]
should return class Window.
Issue happens in class org.neo4j.ogm.metadata.Metadata method "resolve"

Archive.zip

@isakovarseniy
Copy link
Author

isakovarseniy commented Sep 5, 2024

I think issue is in MetaData.class

private ClassInfo findSingleImplementor(ClassInfo interfaceInfo) {
    if (interfaceInfo != null && interfaceInfo.directImplementingClasses() != null
        && interfaceInfo.directImplementingClasses().size() == 1) {
        return interfaceInfo.directImplementingClasses().get(0);
    }
    return null;
}

if interface do not have implementation it will return you interface class itself but should return null. Probably should be like this:

private ClassInfo findSingleImplementor(ClassInfo interfaceInfo) {
	if (interfaceInfo != null && interfaceInfo.directImplementingClasses() != null
			&& interfaceInfo.directImplementingClasses().size() == 1) {

		if (interfaceInfo.isInterface()) {
			return null;
		} else {
			return interfaceInfo.directImplementingClasses().get(0);
		}
	}
	return null;
}

or interfaceInfo.directImplementingClasses() should be empty

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

No branches or pull requests

1 participant