Is there a way to add hints to derby optimizer ?

For example, I have a query that is supposed to use an index. The optimizer mostly uses
the index but sometimes decides to do a table scan!

I have tried different transformations of the query but I see the same inconsistent behavior.

Any suggestions?