ibatis怎么执行sql语句
我想用ibatis执行一条sql语句select*fromtablelimit?,?;其中问号传两个参数count1,count2.在java中怎么执行。请写下具体点的执...
我想用ibatis执行一条sql语句 select*from table limit ?,?; 其中问号传两个参数count1,count2.在java中怎么执行。请写下具体点的执行方法。谢谢了
展开
展开全部
public List<Setting> getAllSettingsPage(String pageSize, String begin, String typeName) {
SqlSession session = null;
try {
session = getSession();
Map<String, String> m = new HashMap<String, String>();
m.put("count", pageSize);
m.put("begin", begin);
m.put("typeName", typeName);
List<Setting> list = session.selectList("getSettingsPage", m);
log.debug("getAllSettingsPage() " + (list == null ? " empty " : "size:" + list.size()));
return list;
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
if (session != null) {
session.close();
}
}
}
请参考
SqlSession session = null;
try {
session = getSession();
Map<String, String> m = new HashMap<String, String>();
m.put("count", pageSize);
m.put("begin", begin);
m.put("typeName", typeName);
List<Setting> list = session.selectList("getSettingsPage", m);
log.debug("getAllSettingsPage() " + (list == null ? " empty " : "size:" + list.size()));
return list;
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
if (session != null) {
session.close();
}
}
}
请参考
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询