em.getTransaction().begin();
StringData sd = em.find(StringData.class, key);
System.out.println("Old value: " + sd.getData());
sd.setData(newValue);
// em.persist(sd);
em.getTransaction().commit();
As you can see, I'm not calling persist, it's commented out, because I'm dry running this code first. However, as it turns out it's not so very dry. Upon inspecting the database, I see the data is changed (fortunately it's a test database).
Apparently my understanding of Hibernate/JPA is flawed. Isn't calling persist always required to change data? And if not, what are the rules on when something is saved?
 
     
     
    