-1

When performing a sub query, I get the following message:

WARN|fflib_QueryFactory.subselectQuery(Schema.SObjectType) is deprecated and will be removed in a future release. Use fflib_QueryFactory.subselectQuery(String) or fflib_QueryFactory.subselectQuery(ChildRelationship) instead.

The code runs successfully, but I received this warning message above. Is there any other way to do a subselect without receiving this message?

fflib_QueryFactory faqsQueryFactory = newQueryFactory();        
    fflib_QueryFactory pFactory = new FAQsSelector().
        addQueryFactorySubselect(faqsQueryFactory);       

    return (List<FAQ__c>) Database.query(
        faqsQueryFactory.setCondition('cat__c =: cat AND subC__c =: subc').toSOQL()
    ); 
  • 2
    The warning itself seems to recommend alternatives. Have you tried them? – Adrian Larson Jun 28 '17 at 21:03
0

If using fflib from at least one year ago, the way to include subselects is given here in this example selecting Opportunities w/ OpportunityLineItems (and lookup parent PricebookEntryProduct2/Pricebook2

public List<Opportunity> selectByIdWithProducts(Set<ID> idSet)
    {
        fflib_QueryFactory opportunitiesQueryFactory = newQueryFactory();

        fflib_QueryFactory lineItemsQueryFactory = 
            new OpportunityLineItemsSelector().
                addQueryFactorySubselect(opportunitiesQueryFactory);

        new PricebookEntriesSelector().
            configureQueryFactoryFields(lineItemsQueryFactory, 'PricebookEntry');
        new ProductsSelector().
            configureQueryFactoryFields(lineItemsQueryFactory, 'PricebookEntry.Product2');
        new PricebooksSelector().
            configureQueryFactoryFields(lineItemsQueryFactory, 'PricebookEntry.Pricebook2');

        return (List<Opportunity>) Database.query(
            opportunitiesQueryFactory.setCondition('id in :idSet').toSOQL());
    }
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.