@SuppressWarnings("unchecked")
  public List<SignalEventSubscriptionEntity> findSignalEventSubscriptionsByExecution(
      String executionId) {
    final String query = "selectSignalEventSubscriptionsByExecution";
    Set<SignalEventSubscriptionEntity> selectList =
        new HashSet<SignalEventSubscriptionEntity>(
            getDbSqlSession().selectList(query, executionId));

    // add events created in this command (not visible yet in query)
    for (SignalEventSubscriptionEntity entity : createdSignalSubscriptions) {
      if (executionId.equals(entity.getExecutionId())) {
        selectList.add((SignalEventSubscriptionEntity) entity);
      }
    }

    return new ArrayList<SignalEventSubscriptionEntity>(selectList);
  }
  @SuppressWarnings("unchecked")
  public List<SignalEventSubscriptionEntity> findSignalEventSubscriptionsByNameAndExecution(
      String name, String executionId) {
    final String query = "selectSignalEventSubscriptionsByNameAndExecution";
    Map<String, String> params = new HashMap<String, String>();
    params.put("executionId", executionId);
    params.put("eventName", name);
    Set<SignalEventSubscriptionEntity> selectList =
        new HashSet<SignalEventSubscriptionEntity>(getDbSqlSession().selectList(query, params));

    // add events created in this command (not visible yet in query)
    for (SignalEventSubscriptionEntity entity : createdSignalSubscriptions) {
      if (executionId.equals(entity.getExecutionId()) && name.equals(entity.getEventName())) {
        selectList.add((SignalEventSubscriptionEntity) entity);
      }
    }

    return new ArrayList<SignalEventSubscriptionEntity>(selectList);
  }