zoukankan      html  css  js  c++  java
  • EmptyResultDataAccessException

    报此错误 :org.springframework.dao.EmptyResultDataAccessException: Incorrect result size: expected 1, actual 0,

    查询的结果集 为null,导致报错 

    @Transactional(readOnly = true)
    public Map<String, Object> findActivityTask(final Long productId){
    return super.findBySQL(new SQLGenerator() {
    @Override
    public Map<String, Object[]> generate() {

    Map<String, Object[]> result = Maps.newHashMap();
    List<Object> list = new ArrayList<Object>();

    StringBuffer sql = new StringBuffer();
    sql.append(" SELECT d.id, d.criteria_tagline AS criteriaTagline FROM ex_product_base AS a ");
    sql.append(" LEFT JOIN ex_activity_gift AS b ON a.id = b.product_id AND b.state = 0 ");
    sql.append(" LEFT JOIN ex_activity_base AS c ON b.id = c.id AND c.state = 0 AND c.open_type = 2 ");
    sql.append(" INNER JOIN ex_activity_task AS d ON c.id = d.activity_base_id AND d.state = 0 AND d.open_type = 2 WHERE 1=1 ");

    if (productId != null) {
    sql.append(" AND a.id = ? ");
    list.add(productId);
    }
    sql.append(" ORDER BY c.create_date DESC LIMIT 1 ");

    result.put(sql.toString(), list.toArray());
    return result;
    }
    });
    }

  • 相关阅读:
    CF538H Summer Dichotomy
    CF1558F Strange Sort
    CF429E Points and Segments
    CF986F Oppa Funcan Style Remastered
    [JOI Open 2016] 摩天大楼
    [做题笔记] 浅谈笛卡尔树结构的应用
    CF1383C String Transformation 2
    CF1558E Down Below
    weex打包安卓艰苦之路
    IntelliJ IDEA 推荐15款插件
  • 原文地址:https://www.cnblogs.com/liduanwen/p/5660650.html
Copyright © 2011-2022 走看看