DATAGRAPH-1377 - Add unknown entities to mapping context when called from templates.

This commit is contained in:
Michael Simons
2020-09-11 16:54:43 +02:00
committed by GitHub
parent 0a10e64295
commit 57d435490d
3 changed files with 3 additions and 1 deletions

View File

@@ -378,6 +378,7 @@ public final class Neo4jTemplate implements Neo4jOperations, BeanFactoryAware {
private <T> ExecutableQuery<T> createExecutableQuery(Class<T> domainType, String cypherStatement,
Map<String, Object> parameters) {
Assert.notNull(neo4jMappingContext.getPersistentEntity(domainType), "Cannot get or create persistent entity.");
PreparedQuery<T> preparedQuery = PreparedQuery.queryFor(domainType).withCypherQuery(cypherStatement)
.withParameters(parameters).usingMappingFunction(neo4jMappingContext.getRequiredMappingFunctionFor(domainType))
.build();

View File

@@ -374,6 +374,7 @@ public final class ReactiveNeo4jTemplate implements ReactiveNeo4jOperations, Bea
private <T> Mono<ExecutableQuery<T>> createExecutableQuery(Class<T> domainType, String cypherQuery,
Map<String, Object> parameters) {
Assert.notNull(neo4jMappingContext.getPersistentEntity(domainType), "Cannot get or create persistent entity.");
PreparedQuery<T> preparedQuery = PreparedQuery.queryFor(domainType).withCypherQuery(cypherQuery)
.withParameters(parameters)
.usingMappingFunction(this.neo4jMappingContext.getRequiredMappingFunctionFor(domainType)).build();

View File

@@ -405,7 +405,7 @@ final class DefaultNeo4jConverter implements Neo4jConverter {
Map<Object, Object> relationshipsAndProperties = new HashMap<>();
// if the list is null the mapping is based on a custom query
if (list == Values.NULL) {
if (Values.NULL.equals(list)) {
Predicate<Value> isList = entry -> entry instanceof Value && typeSystem.LIST().isTypeOf(entry);