class PipelineRunDao extends NamedParameterJdbcDaoSupport {

    @Transactional(propagation = Propagation.REQUIRED)
    public PipelineRun loadPipelineRun(Long id) {
        MapSqlParameterSource params = new MapSqlParameterSource();
        params.addValue(PipelineRunParameters.RUN_ID.name(), id);
        addTaskStatusParams(params);

        List<PipelineRun> items = getNamedParameterJdbcTemplate().query(loadRunByIdQuery, params,
                PipelineRunParameters.getExtendedRowMapper());
        if (!items.isEmpty()) {
            PipelineRun pipelineRun = items.get(0);
            List<RunSid> runSids = getJdbcTemplate().query(loadRunSidsQuery,
                    PipelineRunParameters.getRunSidsRowMapper(), id);
            pipelineRun.setRunSids(runSids);
            List<Map<String, String>> envVars = getJdbcTemplate().query(loadEnvVarsQuery,
                    PipelineRunParameters.getEnvVarsRowMapper(), pipelineRun.getId());
            pipelineRun.setEnvVars(CollectionUtils.isEmpty(envVars) ? null : envVars.get(0));
            return pipelineRun;
        } else {
            return null;
        }
    }

}