cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: DataRow to CDO comparison
Date Fri, 14 Nov 2008 13:48:48 GMT
Yeah, 'objectFromDataRow' is intended for backend updates of the data  
objects, so it works under assumption that the data in the DataRow is  
a DB data, and after a refresh, the object is still COMMITTED.

So do you want to compare the values or actually apply all changes to  
the object with the goal of committing them?

Andrus


On Nov 13, 2008, at 4:31 PM, Andrey Razumovsky wrote:
> Suggest I have a DataRow with fresh data which I want to apply to my
> database, and already a row with same id exists in DB, so
> CayenneDataObject local = (CayenneDataObject)
> DataObjectUtils.objectForPK(context, id);
> is not null.
>
> How can I now compare it with a DataRow? It's logical to use
> DataObject fresh= context.objectFromDataRow(entityName, dataRow,  
> resfresh);
>
> BUT:
> if refresh is false, "fresh" object contains old values (those from  
> local,
> not from dataRow).
> if refresh is true, "fresh" and "local" objects get new values, but  
> property
> change operations are not registered, so context.commitChanges() does
> nothing.
>
> What's the elegant way to refresh object with new dataRow values?


Mime
View raw message