DB2FilterToSQL includes logic to set and test a looseBBOX flag. This controls whether a BBOX filter uses the ST_Intersects predicate or the EnvelopesIntersect predicate. The default is to use ST_Intersects. EnvelopesIntersect generally performs much better and is adequate in many applications. This is needed to support one of our current customers. As a result of the GeoTools JDBC design changes, there is no longer any way for an application to control the setting of the looseBBOX flag.
I modified DB2NGDataStoreFactory to add and check a new LOOSEBBOX parameter which is passed to DB2SQLDialectPrepared.
DB2SQLDialectPrepared and DB2SQLDialectBasic are modified to allow a looseBBOX parameter to be set which is then passed to DB2FilterToSQL.
I tested this from Geoserver by manually adding a "Loose BBOX" parameter to the store XML file. If the parameter does not exist or is set to FALSE, the ST_Intersects predicate is used. If the parameter exists and is set to TRUE, EnvelopesIntersect is generated.
Is DB2SQLDialectBasic used anymore? It isn't clear to me.
This fix will also be required in trunk. I haven't sorted out the current design in trunk which looks quite different.