Thanks, but such code is not a good solution. It requires to write lots of code manually, and is error prone, as you may forget to update the comparison code when you add new field to the object.
Isn't it possible to convert the object to list (or iterator) of key/value tuples (or value references) and compare it?