Does running an EJBQL UPDATE statement defeat the performance benefits of container managed persistance when compared to modifing the accessors on a managed entity?
I m interested in this specifically for a database load / performance perspective.
For example, if I have an entity called MyEntity and I want to update myField1 and myField2 is there a performance difference between the two following methods:
Query query = em.createQuery("UPDATE MyEntity m SET m.myField1 = :value1, m.myField2 = :value2 WHERE m.id = :id")
query.executeUpdate();
versus
MyEntity myEntity = find("123");
myEntity.setMyField1("newvalue");
myEnttiy.setMyField2("newvalue2");