Main Menu
Lecture 1
Lecture 2
Lecture 4
Lecture 5
Lecture 6
Lecture 7
 

 

 

Create a fetch specification graphically in EOModeller

Fetch spec is named and stored in the model

1. Select entity and click on new fetch specification button

2. Enter the name of the fetch spec followed by return - name in index on left should change

3. Click in the window below the greyed out comparison button to get a field to enter specification into

4. Type in qualifier using comparison buttons

(lastName like lastName)

5. $variablename - references to a variable - so you have to provide value either

at compile time

bindings.setObjectForKey("*e*", "lastName");

or at run time

6. Save model

7. Change Java code in Main


//Constructors
public Main(WOContext context) {
super(context);
// Perform an fetch with a specification defined in EOModeller
EOEditingContext ec = session().defaultEditingContext();
NSMutableDictionary bindings = new NSMutableDictionary();
bindings.setObjectForKey("*e*", "lastName");
studentlist = EOUtilities.objectsWithFetchSpecificationAndBindings(ec, "Student", "studentSearch", bindings);
// System.out.println(movielist.count());
}

8. Run and you should get Students whose last name contains an "e", unsorted.

Lecture 3 Fetch Demo 4 ( Download )