Steve, yes, that makes a little sense. is this in production that you are seeing this error? 'cause on your local machine it should just suggest an appropriate index for such a query. just to make sure, the second parameter is a strictly equals predicate, as you have it in your previous message, not an in-equality predicate, right?
I don't know if you've seen it before, but this video from the Google IO conference that talks about the inner storage of BigTable is very helpful in understanding what is going on under the hood. It's really effected how i've designed my data model: http://www.youtube.com/watch?v=tx5gdoNpcZM I believe what is happening is that BigTable is sorting your data on your date (or at least using an index that is sorting on your date) and once it narrows down the entities that match your date predicate, it doesn't know where to find the "field1" parameter ('cause it needs to have that indexed along with your date field). Of course, I don't have any of the code for your model or queries so I may be way off base :) but that's what it sounds like to me. so, I'd try first making sure you can do the query you are trying to do on your local system, then if that succeeds, I'd make sure that your datastore-indexs.xml is consistent between your local and production environments. hope that helps! -bryce On Sep 18, 12:47 pm, sprooooz <[email protected]> wrote: > Thanks for your answers guys, > > actually I ran the exact same query as you bcottam, but as soon as I > add other parameters in the query(like "&& field1==param1"), a > DatastoreNeedIndexException is thrown every time. > any idea why? > > On 18 sep, 16:56, bcottam <[email protected]> wrote: > > > I do this quite a bit in my app. > > Basically I make a query like this: > > Query q = pm.newQuery(MyClass.class, "myDate >= :firstDateParam && > > myDate <= :secondDateParam"); > > Map<String, Object> params = new HashMap<String, Object>(); > > params.put("firstDateParam", startDate); > > params.put("secondDateParam", endDate); > > q.executeWithMap(params); > > > I typed this on my phone, so I may have bitchered some meathod > > signatures, but this is about what I am doing. Hope it helps. > > > On Sep 18, 12:44 am, sproooooz <[email protected]> wrote: > > > > I am trying to write a JDO query where an entity field java.util.Date > > > "DATEFIELD" is between 2 others java.util.Date parameters...but can > > > not succeed > > > Has anybody tried this before? > > > > that would be a big help.... > > > > Steve --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~----------~----~----~----~------~----~------~--~---
