Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. public void update(Project project) {
  2.         System.out.println("project id: " + project.getId());
  3.         if (project == null) {
  4.             log.warn("Null project passed to update");
  5.             return;
  6.         }
  7.         Session session = HibernateUtil.getSessionFactory().getCurrentSession();
  8.         session.beginTransaction();
  9.         try {
  10.             session.update(project);
  11.             session.getTransaction().commit();
  12.         } catch (RuntimeException e) {
  13.             log.error("Error when updating a project:" + project.toString(), e);
  14.             session.getTransaction().rollback();
  15.             throw e;
  16.         }
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement