I'm using hibernate in a Spring framework, and running into an Opportunistic Locking, so I have a fundamental question:
Does Hibernate consider the object "changed/dirty" as soon as its setter is called, for example: theEmployee.setAge(32)
so even if the age field had already been 32, it will be considered "changed", or would hibernate figure out that even though the setter was called, the object, effectively, has not been changed?
In other words, if I want to prevent unnecessary write's, is it necessary to code:
if (theEmployee.getAge() != age) theEmployee.setAge(age)
or it is sufficient to code: theEmployee.setAge(age)
?
Aucun commentaire:
Enregistrer un commentaire