EOModel model = modelForFetchSpecificationAndEditingContext(spec, ec); EOEntity entity = model.entityNamed(spec.entityName()); EOAdaptor adaptor = EOAdaptor.adaptorWithModel(model); EODatabase db = new EODatabase(adaptor); EOSQLExpressionFactory sqlFactory = adaptor.expressionFactory();   NSArray attributesFromEntity = entity.attributesToFetch();  EOSQLExpression sqlExpr = sqlFactory.selectStatementForAttributes(attributesFromEntity, false, spec, entity); sqlExpr.setUseBindVariables(false); String sql = sqlExpr.statement();  return sql;
return sqlForFetchSpecificationAndEditingContext(spec,ec,0,-1);
    public static String sqlForFetchSpecificationAndEditingContext(EOFetchSpecification spec, EOEditingContext ec) {        EOModel model = modelForFetchSpecificationAndEditingContext(spec, ec);        EOEntity entity = model.entityNamed(spec.entityName());        EOAdaptor adaptor = EOAdaptor.adaptorWithModel(model);        EODatabase db = new EODatabase(adaptor);        EOSQLExpressionFactory sqlFactory = adaptor.expressionFactory();        //NSArray attributes = spec.rawRowKeyPaths();        NSArray attributesFromEntity = entity.attributesToFetch();        EOSQLExpression sqlExpr = sqlFactory.selectStatementForAttributes(attributesFromEntity, false, spec, entity);        sqlExpr.setUseBindVariables(false);        String sql = sqlExpr.statement();        return sql;    }