Re: Thoughts from ADO
<anthony <at> berglas.org>
2010-12-17 03:44:03 GMT
Responses below...
At 03:42 AM 26/11/2010, Franck Routier wrote:
>
>
>Hi Anthony,
>
>> The first is DataSet.GetChanges, which produces a dataset which only
>> has changed records. It does a copy, but we could easily do a
>> PurgeCleanRecords. The point being that if a dataset is returned from
>> a remote middle tier, we could purge out any unchanged records for
>> efficiency.
>
>Do you mean if the dataset has to travel on the wire or between several
>JVMs ?
Yes. Well, between two JVMs.
>>
>> The second is AcceptChanges. What this does is explicitly mark a
>> record non-dirty, and copies fields to the optimistic values. It would
>> be called by SessionJDBC after reading or updating records. Might be a
>> slightly cleaner approach to our current handing of dirtyness.
>
>Couldn't you elaborate on this, I don't get the point ?...
This is a minor point, but in our current implementation, retrieveRecord calls defineInitialValue which
is not quite clean, and does not reset dirtyness. I was wondering if it would be better to follow ADO here and
just call AcceptChanges (not a good name) after setting the fields normally.
Also, setting setDirty(false) does not update optimistic values properly.
So one way to clean this up is to replace setDirty(false) and defineInitialValue with just one
AcceptChanges, which clears dirty and flushes optimistic values.
Primary key only records still require thought.
>While we are on new ideas, I'm missing a feature in current Simpleorm,
>related to data validation.
>Currently we can valide a field, or a record.
>But there is no easy way to validate coherence between different
>records.
>For example I can handle the fact that a field must be a date, or a date
>after 01/01/2000, with SValidator. I can check on the record level that
>the beginning date is before the end date of the record, with
>onValidateRecord(). But I have no way to check that two record won't
>have overlapping periods before committing... (well, no way native to
>Simpleorm).
A per record pre-flush hook would be a good idea and easy to implement.
There should probably be a DataSet.DoValidateAllRecords (ie all) and thus a RecordInstance and DataSet
OnValidateAllRecords. Ie. be able to validate independently from flushing. Only dirty records
validated. flush calls dataset.DoValidateAllRecords of course.
(One other idea from ADO is they allow record.BeginEdit/EndEdits to be applied around record changes.
Then EndEdit would call onValidateRecord, whereas we only do that at flush time. But I wonder if that is
really useful.)
>I don't really know how this would be possible, or how other frameworks
>address this issue, but it would certainly be interesting to have.
>
>Any comment ?
>
>Regards,
>
>Franck
>
>
Dr Anthony Berglas, anthony <at> berglas.org Mobile: +61 4 4838 8874
Just because it is possible to push twigs along the ground with ones nose
does not necessarily mean that is the best way to collect firewood.
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/SimpleORM/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/SimpleORM/join
(Yahoo! ID required)
<*> To change settings via email:
SimpleORM-digest <at> yahoogroups.com
SimpleORM-fullfeatured <at> yahoogroups.com
<*> To unsubscribe from this group, send an email to:
SimpleORM-unsubscribe <at> yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
