title: UserTransaction doesn't commit
body: <p>I'm trying to do a password reset with a JSF application, but the userTransaction doesn't work. I assign all the correct values to the entity and then I do utx.commit() but in the database nothing is changed. The message "password has been reset" is displayed and no error happens
  Can you help me? here is the code:</p>
  
  <pre><code>package it.polimi.meteocal.business.control;
  
  import it.polimi.meteocal.business.beans.SendEmailBean;
  import it.polimi.meteocal.business.entity.User;
  import javax.annotation.Resource;
  import javax.ejb.EJB;
  import javax.enterprise.context.RequestScoped;
  import javax.faces.bean.ManagedBean;
  import javax.mail.MessagingException;
  import javax.mail.internet.AddressException;
  import javax.persistence.EntityManager;
  import javax.persistence.PersistenceContext;
  import javax.persistence.Query;
  import javax.transaction.SystemException;
  import javax.transaction.UserTransaction;
  
  @ManagedBean
  @RequestScoped
  public class AccessValidation {
  
      private String password;
      private String confpassword;
      private String username4email;
      private String message;
      private String email;
      private String username;
  
      @PersistenceContext
      EntityManager em;
  
      @EJB
      private CheckFields cf;
  
      @Resource
      UserTransaction utx;
  
      public void passwordReset() {
  
              Query query;
              User user;
  
              if (!cf.checkPassword(password, confpassword)) {
                  message = "Passwords don't match";
              } else if (confpassword.length() &lt; 6) {
                  message = "Password should be at least 6 characters";
              } else {
  
                  try {
  
                      query = em.createQuery("select u from User u where u.username=:um");
                      query.setParameter("um", username);
                      user = (User) query.getResultList().get(0);
  
                      utx.begin();
  
                      user.setPassword(password);
  
                      utx.commit();
                      message = "Password has been reset!";
  
                  } catch (Exception e) {
  
                      e.printStackTrace();
                      try {
                          utx.rollback();
                      } catch (IllegalStateException | SecurityException | SystemException exception) {
                      }
  
                  }
  
              }
          }
  </code></pre>