Czar
11/19/2017, 6:45 PMString#hashCode
for this is a really bad ideaziad
11/20/2017, 10:11 AMCzar
11/20/2017, 11:23 AM@LastModifiedDate
As for an alternative, you could use any of the number of available hash functions, like MD5, or SHA* variants. Problem is with hashes you have to always remember about collisions. Since you're working with JSON (so I assume somewhat long strings with small changes) all hashes I've mentioned should in theory provide very small collision rate.
From what I understand though you're trying to get better performance, timestamps will be much more performant than hashes.
Another idea, instead of a timestamp you could keep an autoincrement field which you increment on each update, so it is effectively your data's version. Some data access libraries even support that, Spring Data for example has @Version
annotation.ziad
11/20/2017, 11:24 AMCzar
11/20/2017, 11:54 AMziad
11/20/2017, 11:54 AM