-
Feb 8th, 2012, 03:45 PM
#1
@Query and returning fetched relationships.
I don't recall if this was in the documentation. But if I want to write a query that retrieves a Node and also fetches related Nodes and I want the repo to return the main Node with their set of related nodes populated. I don't want to put @Fetch on Set<User> friends property of User, as there are many use cases where I need the User without their friends.
Would it be something like (method name is exaggerated for demo purposes)
@Query("start user=node({0}) " +
"match (user)-[:FRIEND]-(friends) " +
"return user, friends ")
public User findUserWithAllTheirFriendsFetchedIntoTheSetOfFrie ndsInUser(Long nodeId);
Thanks
Mark
-
Feb 11th, 2012, 12:22 AM
#2
Sorry have to bump this, the answer will have a profound affect on my apps design/architecture/layout.
Basically, my single page app might be making 7 Web Requests to get each part of the page to display all the Node based on 7 different relationships, and I wanted to know if Cypher has the equivalent of JPA's fetch in a query like
SELECT u FROM User u JOIN FETCH u.friends f JOIN FETCH f.friends
Thanks
Mark
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules