In jbosscmp-jdbc.xml, a cmp-field may have an optional
element <state-factory>. The value should the fully
qualified class name of the implementation of
interface which has the following two methods:
* Calculates and returns an object that represents
the state of the field value.
* The states produced by this method will be used
to check whether the field
* is dirty at synchronization time.
* @param fieldValue field's value.
* @return an object representing the field's state.
Object getFieldState(Object fieldValue);
* Checks whether the field's state <code>state</code>
* is equal to the field value's state (possibly,
* the <code>getFieldState()</code> method).
* @param state the state to compare with field
* @param fieldValue field's value, the state of
which will be compared
* with <code>state</code>.
* @return true if <code>state</code> equals to
boolean isStateValid(Object state, Object fieldValue);
There are default implementations for Map, List, Set
and arrays which are set automatically for fields of
the corresponding types.
For primitives, their wrappers and java.lang.String,
the implementation relies on equals(Object o) method to
check the dirty state.
The default implementation for other types always
returns false from isStateValid() unless one of the
arguments is null and the other one is not.