one-time-examples/bestellprozess-java-ee6/src/main/java/com/camunda/demo/outerspace/wjax/controller/TaskListController.java
@Produces
  @Named("orderProcesses")
  public List<OrderProcessDTO> getOrders() {
    ProcessEngineImpl processEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine();
    ProcessEngineConfigurationImpl processEngineConfiguration = processEngine.getProcessEngineConfiguration();

    MyBatisQueryCommandExecutor commandExecutor = new MyBatisQueryCommandExecutor(processEngineConfiguration, "customMappings.xml");
    return commandExecutor.executeQueryCommand(new Command<List<OrderProcessDTO>>() {

      @SuppressWarnings("unchecked")
      public List<OrderProcessDTO> execute(CommandContext commandContext) {
        return (List<OrderProcessDTO>) commandContext.getDbSqlSession().selectList("selectOrdersWithProcessInformation", null);
      }
    });
  }
@Produces
  @Named("orderProcesses")
  public List<OrderProcessDTO> getOrders() {
    ProcessEngineImpl processEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine();
    ProcessEngineConfigurationImpl processEngineConfiguration = processEngine.getProcessEngineConfiguration();

    MyBatisQueryCommandExecutor commandExecutor = new MyBatisQueryCommandExecutor(processEngineConfiguration, "customMappings.xml");
    return commandExecutor.executeQueryCommand(new Command<List<OrderProcessDTO>>() {

      @SuppressWarnings("unchecked")
      public List<OrderProcessDTO> execute(CommandContext commandContext) {
        return (List<OrderProcessDTO>) commandContext.getDbSqlSession().selectList("selectOrdersWithProcessInformation", null);
      }
    });
  }
See https://app.camunda.com/confluence/display/foxUserGuide/Performance+Tuning+with+custom+Queries