Wait .. What? Why? Use the eo's snapshot.

Sent from my iPhone

On May 25, 2011, at 2:20 PM, David Avendasora <webobje...@avendasora.com> wrote:

> I'm guessing this will trigger another round-trip to the db, but what about 
> adding this to your EOGenericRecord subclass:
> 
>    public int rawHashCode() {
>        return EOUtilities.rawRowsMatchingKeyAndValue(editingContext(),
>                                                      Identity.ENTITY_NAME,
>                                                      ID_KEY,
>                                                      primaryKey())
>                          .lastObject()
>                          .hashCode();
>    }
> 
> Obviously, getting the value at a higher level would be better, but does this 
> at least return the same hashCode for every fetch?
> 
> Of course, Mike's ERCStamped solution is probably better with less overhead, 
> but what the heck. If I never try to upstage him then it'll never happen, 
> right?!
> 
> Dave
> 
> On May 25, 2011, at 1:55 PM, Pascal Robert wrote:
> 
>> I'm trying to find a way to generate a HTTP ETag for EOs so that caching can 
>> be done for REST services. What I want to do is to have the same ETag value 
>> for each representation of the EO, so when one of the values change, the 
>> ETag value will also change, but if the EO have the same value, it will 
>> generate the same ETag as another request got.
>> 
>> Problem is: I don't know what to use. I tried with myEO.hashCode() but I did 
>> some tests and every time I fetch the EO, the hashcode is different even if 
>> the data didn't change. I'm thinking of doing a MD5 digest of part of the 
>> EO, but I was wondering if another way exist? I could use a "last modified" 
>> date and generate a MD5 of that too, but that date is a better option for 
>> the Last-Modified header.
>> 
>> --
>> Pascal Robert
>> prob...@macti.ca
>> 
>> WOWODC 2011 : July 1-2-3, Montreal. wowodc.com
>> 
>> AIM/iChat : MacTICanada
>> LinkedIn : http://www.linkedin.com/in/macti
>> Twitter : pascal_robert
>> 
>> 
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com
>> 
>> This email sent to webobje...@avendasora.com
>> 
>> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com
> 
> This email sent to msch...@pobox.com
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to