java - JPA persisting instead of updating -
I have come across a strange problem, whenever I try to edit a register in my application instead of the unit To update the situation, it remains a new one. Here my update method goes public obituary (object obj) {EntityManagerFactory fac = persistence .createEntityManagerFactory ("crud"); EntityManager em = fac.createEntityManager (); Em.merge (obj); Em.getTransaction () start () .; Committed to em.getTransaction (). Em.close (); Fac.close (); } My guess is that when I submit the edit form and the setters are called Id , somehow is set to 0. Is this possible? The form looks like this: & lt; H: form & gt; & Lt; P: panel grid column = "2" style = "margin: 0 auto;" & Gt; & Lt; F: Aspect Name = "Header" & gt; Edit form & lt; / F: Aspect & gt; Name: & lt; H: inputText id = "nome" value = "# {editUserBean.userToEdit.name}" /> Age: & lt; H: Input Text = "# {editUserBean...