I want to state this proposal with the following respect of:
1.) the fact of keeping a grip on the api "bloat" factor.
2.) the fact that this scenario can be managed via the <class dynamic-update=""> property.
3.) the fact that this proposal coding time to implement may be exponential.
The Proposal
Add a <property update-strategies=""/> attribute and a new method Session.update( Object obj, String updateStrategy ).
Not to be confused with the already existing <property update="true|false"> attribute.
Note that the current Session.update() methods would still update all columns regardless of update-strategies.
My reasoning for this proposal vs "dynamic-update" is control of columns updated can actually be configurated via strategies/scenarios.
I can probably best explain by example:
Code:
Class ItemMstr {
long id;
String itemNo;
String description;
String revision;
int quantity;
double costMaterial;
/* etc, setters/getters... */
}
Code:
<property
name="quantity"
column="quantity"
type="int"
update-strategies="quantity-only,other-strategy"
/>
<property
name="description"
column="description"
type="string"
update-strategies="other-strategy"
/>
Notice multiple strategies could be applied per property.
Then:
sess.update( itemMstr, "quantity-only" );
Only updates "quantity" column.
sess.update( itemMstr, "other-strategy" );
Would update "quantity" and "description" columns.
Note that the existing Session.update() methods would still update all columns regardless of update-strategies.