Changes for page The EOModel
Last modified by Pascal Robert on 2012/03/10 15:42
From version 26.1
edited by Pascal Robert
on 2011/02/24 14:14
on 2011/02/24 14:14
Change comment:
There is no comment for this version
To version 24.1
edited by Pascal Robert
on 2011/02/27 12:28
on 2011/02/27 12:28
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -209,6 +209,34 @@ 209 209 210 210 == Fetch Specs in Model == 211 211 212 +After you create and configure entities in EOModeler, you can also use it to build queries on those entities called fetch specifications. A fetch specification (a com.webobjects.eocontrol.EOFetchSpecification object) is the object Enterprise Objects uses to get data from a data source. 213 + 214 +Each fetch specification can contain a qualifier, which fetches only those rows that meet the criteria in the qualifier. A fetch specification allows you to specify a sort ordering to sort the rows of data returned. A fetch specification can also have other characteristics, as discussed in this chapter. 215 + 216 +Fetch specifications you build in EOModeler are referred to as named fetch specifications. To use a named fetch specification requires that you get hold of the model object in which the fetch specification exists. The code in Listing 7-1 retrieves a fetch specification called "MyFetch" in an entity named "Listing" by looking for it in all the models in the application's default model group. 217 + 218 +If you define a qualifier like this: 219 + 220 +{{code}} 221 +(askingPrice < $askingPrice) and (bedrooms = $bedrooms) and (bathrooms = $bathrooms) 222 +{{/code}} 223 + 224 +then the qualifier variables are replaced by 500000 (askingPrice), 4 (bedrooms), and 3 (bathrooms). 225 + 226 +{{code}} 227 + 228 +EOModelGroup modelGroup = EOModelGroup.defaultGroup(); 229 +EOFetchSpecification fs = modelGroup.fetchSpecificationNamed("MyFetch", "Listing"); 230 +fs = fs.fetchSpecificationWithQualifierBindings(dictionary); 231 +NSMutableDictionary dictionary = new NSMutableDictionary(); 232 +dictionary.takeValueForKey("500000", "askingPrice"); 233 +dictionary.takeValueForKey("4", "bedrooms"); 234 +dictionary.takeValueForKey("3", "bathrooms"); 235 + 236 +{{/code}} 237 + 238 +== Stored procedures == 239 + 212 212 You can set up an EOModel so that Enterprise Objects automatically invokes a stored procedure for these operations on an entity: 213 213 214 214 Insert to insert a new object into an entity