Siva
Siva

Reputation: 3327

Hibernate Versioning Object

If we update any value in a row, version column will updated by +1 value.., this is actual concept.

My question is if we update the object with the same values.., then will the version column will incremented by +1 or will as as it is ?

Upvotes: 0

Views: 131

Answers (1)

JB Nizet
JB Nizet

Reputation: 691785

Hibernate stores a snapshot of the object in memory when it loads it from the database. When a flush is done, it compares the state of the object with the snapshot stored at loading time. If the state hasn't changed, the object is not dirty, and no update will be done for this object, so no version increment either.

Upvotes: 1

Related Questions