0

Как переделать метод, чтобы он возвращал тип Competition?

public Competition updateCompetition(Long id, Integer point, Integer place){
            Query q = sessionFactory.getCurrentSession().createQuery("update Competition set point= :point, place= :place where id = :id");
            q.setParameter("id", id);
            q.setParameter("point", point);
            q.setParameter("place", place);
            return (Competition) q.executeUpdate();//так не приводит типы
        }
4
  • 1
    Вам обязательно использовать HQL? Или можно предложить способ попроще?
    – arg
    1 мар 2015 в 15:32
  • Нужно делать еще один селект с переданным id.
    – andreycha
    1 мар 2015 в 16:19
  • да, нужно HQL.
    – GuestNew
    2 мар 2015 в 13:44
  • Такой селект делать? public Competition retriveCompById(Long id){ Query q = sessionFactory.getCurrentSession().createQuery("from Competition where id = :id"); q.setLong("id", id); return (Competition) q.uniqueResult(); }
    – GuestNew
    2 мар 2015 в 13:47

0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Посмотрите другие вопросы с метками или задайте свой вопрос.