Leon

Create a dictionary with the keys and values you want, then apply this
dictionary to your fetch spec with
fetchSpecificationWithQualifierBindings. Here's some code that gives you
the whole story...

 bindings = new NSMutableDictionary();
 bindings.setObjectForKey(username, "user");
 bindings.setObjectForKey(password, "password");
 ent = EOModelGroup.defaultGroup().entityNamed("User");
 fs = ent.fetchSpecificationNamed("login");
 fs = fs.fetchSpecificationWithQualifierBindings(bindings);
 potentialUsers = editingContext.objectsWithFetchSpecification(fs);

By the way if you use EOUtilities there is this short cut:

 potentialUsers = 
   EOUtilities.objectsWithFetchSpecificationAndBindings(
   editingContext, "User", "login", bindings);

Here's the doc on this shortcut EOUtilties method:

public static NSArray objectsWithFetchSpecificationAndBindings(
com.apple.yellow.eocontrol.EOEditingContext editingContext, 
java.lang.String fetchSpecName, 
java.lang.String entityName, 
NSDictionary bindings)


d

Leon Amdour wrote:
> 
> Hello, everyone.
> 
> I'm new to WebObjects and my quesion may sound trivial. I've searched
> documentation, but couldn't find the answer.
> I've created a Fetch Specification that uses qualifier variables. I am
> trying to  set their values from the code and then fetch data.
> Documentation suggests to bind qualifier variables to elements of
> interface, but this is not what I want to do. I want to do everythign in
> the code.
> Could anyone, please, help me out with this?
> 
> Thanks a lot.
> Leon
> 
> P.S. I'm using version 4 under NT.

Reply via email to