提问人:SectionPJY 提问时间:12/13/2022 更新时间:12/13/2022 访问量:185
mybatis 中的 selectone 抛出 nullpointerException
selectone in mybatis throws nullpointerException
问:
道
// Review Total Count
public int reviewTotalCnt() {
System.out.println("========== Review Total Count DAO ==========");
return sqlSession.selectOne("ReviewMapper.reviewTotalCnt");
}
XML格式
<!-- Review Total Count -->
<select id="reviewTotalCnt" resultType="int">
SELECT COUNT(r_id)
FROM b_review;
</select>
请帮忙
我尝试将XML resultType更改为Integer,将返回类型更改为Integer,但没有用。
答: 暂无答案
评论
sqlSession
null
if (sqlSession == null) { throw new RuntimeException("sqlSession is null");}
selectOne()