O'Reilly logo

Force.com Enterprise Architecture by Andrew Fawcett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing the standard query logic

The previous Selector usage example required a cast of the list returned to a list of Race__c objects, which is not ideal. To improve this, you can easily add a new method to the class to provide a more specific version of the base class method, as follows:

public List<Race__c> selectById(Set<Id> raceIds)
{
  return (List<Race__c>) selectSObjectsById(raceIds);
}

Thus, the usage code now looks like this:

List<Race__c> races = new RacesSelector().selectById(raceIds); 

Standard features of the selectSObjectsById method

In addition to forming the field list used in the SOQL query, the base class and the selectSObjectById method used also provide additional functionality that would normally have to be replicated each ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required