iBATIS参数的学习,首先我们看看都有哪些iBATIS参数:
◆iBATIS参数之:原型参数
- ﹤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);
◆iBATIS参数之: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);
◆iBATIS参数之:对象参数
- ﹤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);
iBATIS参数的基本情况就介绍到这里,希望通过介绍使得你对iBATIS参数有一定的了解。
【编辑推荐】