10.2 problem with ArcGISFeatureLayer queryFeatures()

Discussion created by knisleyj on Nov 14, 2013
This is for an ArcGISFeatureLayer that was initialized using a layer definition and feature set rather than a URL, and I think something must have changed with the way queries work in the new API. In the previous API version the following code worked as expected.

I have a feature layer with a few hundred graphics, and I'm trying to query one based on an ObjectID. The following code returns a null feature set even though a graphic with the ObjectID value exists.
Query query = new Query();
query.setWhere("OBJECTID = 1");

In fact, it looks like ANY where clause returns a null feature set. Even "1 = 1".

If I set the geometry in addition to the where clause, I get all 400 graphics returned and the where clause is ignored.
Query query = new Query();
query.setWhere("OBJECTID = 1");

If I loop through the features I can find the one with the ObjectID that I want, and that will be my workaround for now, but I don't understand while simply using setWhere() no longer works and why the where clause is ignored when setGeometry() is used.