Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Support for dirty tracking #64

Closed
ldriscoll opened this Issue Jan 31, 2012 · 2 comments

Comments

Projects
None yet
2 participants

Sorry, I created this on google code already. It would be helpful to have dirty tracking on objects, so that an extra save to couch could be avoided; reducing wasted revision changes.

Owner

helun commented Feb 5, 2012

Dirty tracking is pretty complex to implement as it implies that you have to create proxies around all objects as they are loaded from the db. You risk running into all kinds of class loader trouble and what not.

Or is there a better way?

Yes, that is definitely a complex, and common, way of doing it. The way I was thinking was that, before marshalling the json into an object, take that json and perform a hashsum on it, store the hash in a JsonIgnore variable on on CouchDbDocument. Then, before performing a save do a new hashsum on the unmarshalled json. Compare those two values, and chose whether or not to save. If we do save then we can recalculate the hashsum with the new revision included.

@helun helun closed this Jun 26, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment