-
Notifications
You must be signed in to change notification settings - Fork 620
Closed
Labels
status: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triaged
Description
Hello!
I don't know if it's a bug or if it's wished this way, but I find the issue to be a little problematic. My example requires to return the results from a custom query into a DTO projection, but without a root entity in the projection. Here is an example
Given this custom cypher query
MATCH (department:Department)
OPTIONAL MATCH (person:Person)-[:MEMBER_OF]->(department)
RETURN department.id as departmentId, collect(DISTINCT person.id) as peopleIds And this projection DTO
data class PeopleInDepartmentProjection(
val departmentId: String,
val peopleIds: List<String>
)I get the following error:
org.springframework.data.neo4j.core.mapping.NoRootNodeMappingException: Could not find mappable nodes or relationships inside Record<{departmentId: "b35541a7-fe96-4782-9d11-6ad42a6d83c8", peopleIds: []}> for org.springframework.data.neo4j.core.mapping.DefaultNeo4jPersistentEntity@baa6277
at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:103)
at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:66)
at org.springframework.data.neo4j.core.mapping.Schema.lambda$getRequiredMappingFunctionFor$0(Schema.java:96)
at
I'm wondering if it's wished that you absolutely need a root object to project the results of a query?
FYI, I have this workaround for now
MATCH (department:Department)
OPTIONAL MATCH (person:Person)-[:MEMBER_OF]->(department)
RETURN department, collect(DISTINCT person.id) as peopleIds and I updated the DTO accordingly
alxxyz, ms007, Bharat-Jangid, rohaldb, Qingsx and 3 moreQingsx
Metadata
Metadata
Assignees
Labels
status: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triaged