title: Cannot update entity using Hibernate
body: <p>I am using Hibernate with JPA annotated entities and the next code which I expect to update "<code>raw_text</code>" field of an entity doesn't change it. How to achieve the expected behavior?</p>
  
  <pre><code>@Override
  public void updatePageWithText(String pageName, String rawText) {
       Session session = HibernateUtils.getInstance().openSession();
       String hql = "FROM WikiPage M WHERE M.name = :name";
       Query query = session.createQuery(hql);
       query.setParameter("name",pageName);
  
       WikiPage res = null;
       try {
           res = (WikiPage) query.list().get(0);
           res.setRawText(rawText);
           session.update(res);
           session.flush();
       }
       catch (IndexOutOfBoundsException e) {}
       finally {
           session.close();
       }
  
  }
  </code></pre>