lianghyan
发贴: 38
积分: 1
|
于 2008-03-18 09:30
原型参数 <select id="select1" parameterClass="java.lang.String" resultClass="AppLog"> select ID as id, TYPE as type, DESCR as descr from APP_LOG where ID = #id# </select> sqlMapper.queryForObject("select0", id);
Map类参数 <select id="select2" parameterClass="java.util.HashMap" resultClass="AppLog"> select ID as id, TYPE as type, DESCR as descr from APP_LOG where ID = #id# </select> map.put("id", id); AppLog log = (AppLog) sqlMapper.queryForObject("select0", map);
对象参数 <select id="select3" parameterClass="AppLog" resultClass="AppLog"> select ID as id, TYPE as type, DESCR as descr from APP_LOG where ID = #id# </select> AppLog p=new AppLog(); p.setId(id); AppLog log = (AppLog) sqlMapper.queryForObject("select3", p);
<select id="select0" resultClass="AppLog"> select ID as id, TYPE as type, DESCR as descr from APP_LOG where ID = #id# </select> Map参数 map.put("id", id); AppLog log = (AppLog) sqlMapper.queryForObject("select0", map); String参数 AppLog log = (AppLog) sqlMapper.queryForObject("select0", id); 对象参数 AppLog p=new AppLog(); p.setId(id); AppLog log = (AppLog) sqlMapper.queryForObject("select0", p);
|