How to alter the method so that it returns the type of 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();//так не приводит типы } 
  • one
    Do you have to use HQL? Or you can offer a simpler way? - arg
  • It is necessary to do one more with the transferred id. - andreycha
  • Yes, you need HQL. - GuestNew
  • Such to do? public Competition retriveCompById (Long id) {Query q = sessionFactory.getCurrentSession (). createQuery ("from Competition where id =: id"); q.setLong ("id", id); return (Competition) q.uniqueResult (); } - GuestNew

0