Re: EOSharedEditingContext Useful for Read-Mostly?
Re: EOSharedEditingContext Useful for Read-Mostly?
- Subject: Re: EOSharedEditingContext Useful for Read-Mostly?
- From: Anthony Paras <email@hidden>
- Date: Tue, 27 Jul 2004 00:20:58 -0400
If your goal is to limit trips to the database for these hotel objects, you
could do the following:
1 - assuming you have an integer primary key called oid on the hotel object,
expose the primary key in the model, or create your own method to expose it.
2 - create the following static method in your Hotel class:
public static Hotel cheapHotelWithOid(EOEditingContext ec, Integer id) {
Hotel hotel = (Hotel)ec.faultForRawRow(
new NSDictionary( id, "oid"), "Hotel");
hotel.willRead();
if (hotel.oid() == null) return null;
return hotel;
}
"Cheap" in this case refers to the operation, not the hotel. ;) If the EO
is in the cache and it's not too old, EOF will serve it up rather than go to
the database.
I'm assuming that you know the oid of the hotel from the request.
- Tony
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.