Enhancement 108 : ENHANCEMENT: Update only changed properties
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
1.2.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
25/04/2009
Updated 
25/04/2009
Type 
Enhancement
 
Attachments 
No attachments

Support has been added for updating only the properties that have been changed (as opposed to the loaded properties).

This can be set globally or on a entity by entity basis with an UpdateMode annotation.

To turn this on globally, in ebean.properties:

ebean.updateChangesOnly=true

 
Rob 25 Apr 23:13
Fixed in HEAD

This change is in HEAD.

imario 28 Apr 12:33
Version column not updated

The reson is, that in UpdateHandler.isIncluded now the check honors the updatedProerties only, and the version column has not been updated.

I think the version column needs to be included always in the update, which I did locally using this patch:

Index: ../ebean/src/com/avaje/ebean/server/persist/dml/UpdateHandler.java
===================================================================
--- ../ebean/src/com/avaje/ebean/server/persist/dml/UpdateHandler.java (revision 218)
+++ ../ebean/src/com/avaje/ebean/server/persist/dml/UpdateHandler.java Tue Apr 28 14:25:43 CEST 2009
@@ -86,7 +86,7 @@

@Override
public boolean isIncluded(BeanProperty prop) {
- return (updatedProperties == null || updatedProperties.contains(prop.getName()));
+ return prop.isVersion() || (updatedProperties == null || updatedProperties.contains(prop.getName()));
}

}

Rob 29 Apr 12:14
Updated with Mario's change

Updated to include Mario's change (to include the version property).

Also made some more updates around embedded beans.

Note: currently there is not support for 'partially populated' embedded beans.

woResponse

Upload a file