ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Bradley <debrad...@gmail.com>
Subject Dirty checking
Date Thu, 06 Oct 2005 21:23:30 GMT
I'm interested in implementing a dirty-checking system. I know that
iBATIS doesn't directly do that, but I'm wondering if anyone else has
developed or thought of a successful approach.

It would be possible of course to add a dirty flag to an entity, then
cause each mutator to set that flag to true. The problem, however, is
that when iBATIS constructs an object (as I understand it) it calls
the mutators. So any object freshly pulled from the database would be
incorrectly marked as dirty.

If iBATIS guarantees the order it calls on setters based on the order
they appear in the mapping, then it seems it would be possible to
effectively add a setDirty(false) in the result map as the last result
map property. But does iBATIS make this guarantee?

If not, another approach would be to use some sort of listener or hook
into an event system so that after iBATIS loads an object, I could tie
in some code that reset the dirty flag on the object. Does iBATIS have
any such hooks?

Or is there yet another way to make dirty checking work on top of
iBATIS? Thanks for any ideas.

Mime
View raw message