您的位置:首页 > 其它

iBatis中关于count(*)的写法

2016-03-22 18:32 176 查看
    今天要在iBatis写一个count(*)的sql,发现sql好写,但是dao层不知道该怎么写,尝试了好久,终于解决,下面粘处代码,希望给遇到同类问题的童鞋点参考。

mapper.xml:

<select id="selectCount" parameterClass="map" resultClass="java.lang.Integer">//这里注意要用Integer

select count(*)
from tableName
where
paramName=#paramName#
</select>

dao:

return (Integer)queryForObject("selectCountNameSpace.selectCount", map);

问题解决
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: