@Override
    protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException {
        Filter filter = query.getFilter();
        
        // handle query filter
        if (filter instanceof IncludeFilter) {
            // don't care about this filter, ignore it
        } else if (filter instanceof BBOX) {
            LOGGER.severe("HANDLE BBOX FILTER!!");
        } else {
            throw new UnsupportedOperationException("Filter of type " + filter.getClass().getName() + " is not supported by getBoundsInteral!");
        }
                
        
        
        ReferencedEnvelope bounds = null;
        try {
            Statement q = getDataStore().getConnection().createStatement();
            
            ResultSet res = q.executeQuery(
                                "SELECT " +
                                "MIN(" + geometryColumn + "_x) AS minx, " +
                                "MAX(" + geometryColumn + "_x) AS maxx, " +
                                "MIN(" + geometryColumn + "_y) AS miny, " +
                                "MAX(" + geometryColumn + "_y) AS maxy " +
                                "FROM " + typeName                
                            );  
            
            if (res.next() == false) throw new IOException("unable to fetch bounds");
            
            bounds = new ReferencedEnvelope(
                        res.getDouble("minx"),
                        res.getDouble("maxx"),
                        res.getDouble("miny"),
                        res.getDouble("maxy"),
                        getSchema().getCoordinateReferenceSystem()
                    );
            
            res.close();
            q.close();
        } catch (SQLException ex) {
            throw new IOException(ex);
        }
        
        return bounds;
    }