class CollectionDao extends HibernateDao<Collection, String> {

   @SuppressWarnings ("unchecked")
   public List<Collection> getCollectionsOfProduct (final Long product_id)
   {
      return getHibernateTemplate().execute(session -> {
         String hql = "select c from Collection c "
                    + "left outer join c.products p where p.id = ? ORDER BY c.name";
         Query query = session.createQuery(hql);
         query.setFetchSize(10_000);
         query.setParameter(0, product_id, StandardBasicTypes.LONG);
         return (List<Collection>) query.list();
      });
   }

}