public boolean isUserAssignedToSiteSurvey(String userId, String siteSurveyId) {
try (Session session = driver.session(SessionConfig.forDatabase(serverName))) {
String query = """
MATCH (u:User)-[:ASSIGNED_TO]->(s:SiteSurvey)
WHERE u.id = $userId AND s.id = $siteSurveyId
RETURN 1 AS found
LIMIT 1
""";
Result result = session.run(query,
Values.parameters("userId", userId, "siteSurveyId", siteSurveyId));
return result.hasNext();
}
}
This works !
But when i send it like this
MATCH (:User {id: $userId})-[:ASSIGNED_TO]->(:SiteSurvey {id: $siteSurveyId}) RETURN 1 it fails however when i use the same query directly inside of ArcadeDb UI it does work.