getPurchases to HQL