Consider that I’ve got a standard Java bean: i.e. it contains members that are String
, List
, HashMap
, etc.
My question is: what’s the easiest way to detect if an instance of such an object has been modified from say a previous/original state?
The reason I want to know this is so I determine whether I should update the object in the DB, or not, in the case where either: (i) no changes were made, or (ii) changes were made but then reversed.
I’ve been thinking about comparison of hashCode, or byte[], but doesn’t seem to work. Any ideas?