-
Notifications
You must be signed in to change notification settings - Fork 617
Deterministic mapping of records with mixed results #2246
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
Comments
meistermeier
added a commit
that referenced
this issue
May 6, 2021
meistermeier
added a commit
that referenced
this issue
May 6, 2021
If a record contains more than just a node, for example a node and an additional field, the labels were ignored. The default behaviour was to take the nodes provided by the node description to instantiate the entity class. This can lead to problems with abstract base classes, because the detailed information which concrete implementation to choose from was more or less random. Closes #2246
meistermeier
added a commit
that referenced
this issue
May 6, 2021
If a record contains more than just a node, for example a node and an additional field, the labels were ignored. The default behaviour was to take the nodes provided by the node description to instantiate the entity class. This can lead to problems with abstract base classes, because the detailed information which concrete implementation to choose from was more or less random. Closes #2246
I am testing using It will be really useful to get this code snippet somewhere in the documentation BiFunction<TypeSystem, MapAccessor, DatabaseObject> mappingFunction = neo4jMappingContext.getRequiredMappingFunctionFor(DatabaseObject.class);
Collection<QueryResultWrapper> wrapper = neo4jClient.query("MATCH (a:DatabaseObject{dbId:$dbId})-[r:input]->(m:PhysicalEntity) RETURN m, 3 as n")
.bindAll(map).fetchAs(QueryResultWrapper.class)
.mappedBy((typeSystem, record) -> {
DatabaseObject n = mappingFunction.apply(typeSystem, record.get("m"));
int number = record.get("n").asInt();
return new QueryResultWrapper(n, number);
}).all(); |
meistermeier
added a commit
that referenced
this issue
May 6, 2021
If a record contains more than just a node, for example a node and an additional field, the labels were ignored. The default behaviour was to take the nodes provided by the node description to instantiate the entity class. This can lead to problems with abstract base classes, because the detailed information which concrete implementation to choose from was more or less random. Closes #2246
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since we do not officially support this, I would call this an enhancement instead of a bug fix ;)
Given that we want to map something like
the mapping mechanism will create a
Map
that will only contain the identifier and the node description of the template / repository. If this node description is an (abstract) parent class, we will then lose the information about the concrete type coming from the node's label.The text was updated successfully, but these errors were encountered: