@Transactional
 public List<PreparedDish> getByOrder(OrderNum orderNum) {
   Session session = sessionFactory.getCurrentSession();
   Query query = session.createQuery("select e from PreparedDish e where e.order = :orderNum");
   query.setParameter("orderNum", orderNum);
   return query.list();
 }
Example #2
0
 @Override
 @Transactional(propagation = Propagation.MANDATORY)
 public Dish getById(int id) {
   Query query =
       sessionFactory.getCurrentSession().createQuery("select d from Dish d where d.id = :id");
   query.setParameter("id", id);
   return (Dish) query.uniqueResult();
 }
Example #3
0
 @Override
 @Transactional(propagation = Propagation.MANDATORY)
 public Dish findByName(String name) {
   Query query =
       sessionFactory.getCurrentSession().createQuery("select d from Dish d where d.name = :name");
   query.setParameter("name", name);
   return (Dish) query.uniqueResult();
 }