I am using spring-data-neo4j. I want the results of the query to be mapped to a non-entity POJO.
This is how the repository looks like
public interface CategoryRepository extends GraphRepository<Category> {
@Query("Match (:Client {email: {clientEmail}})-[:client]->()" + "-[:owns]->()-[:had]->(a:visit)-[:to]->()-[:category]->(b)"
+ " where a.lastPredictionTime > {startTime} and a.lastPredictionTime < {endTime}" + " with Distinct b.name as category, sum(a.timeSpent) as sum order by sum desc"
+ " return collect({category: category, timeSpent: sum})[{start}..{end}]")
List<CountDetailsByDate> getTopCategoriesByTimeSpent(@Param("clientEmail") String clientEmail, @Param("start") int start, @Param("end") int end,
@Param("startDate") long startDate, @Param("endDate") long endDate);
}
The CountDetailsByDate object is neither a node entity nor a relationship entity, I want the result of the query to be mapped to it. Is there any way to do that?