Database Reference
In-Depth Information
Listing 11-58.
The
friendsPurchase
Method
@Query("MATCH (u:User { userId : {userId} } )-[:FOLLOWS]-(f)-[:MADE]->()-[:CONTAINS]->p " +
" RETURN p.productId as productId, " +
" p.title as title, " +
" collect(f.firstname + ' ' + f.lastname) as fullname, " +
" null as wordPhrase, " +
" count(f) as cfriends " +
" ORDER BY cfriends desc, p.title ")
List<MappedProductUserPurchase>
friendsPurchase
(@Param("userId") String userId);
Figure 11-18.
Products Purchased by Friends
Specific Products Purchased by Friends
If you click on the “Specific Products Purchased By Friends” link, you can specify a product, in this case “Star Wars Mimbot
Thumb Drives”, and then search for friends who have purchased this product, as shown in Figure
11-19
. This is done via
the
friendsPurchaseByProduct
method in
PurchaseImpl
, which then makes use of the
friendsPurchaseByProduct
in
the
MappedProductUserPurchaseRepository
interface, as shown in Listing 11-59.