Ibatis 的 Ibator 在默认情况下会生成 xxxSchema 对应的 xxxExample 类,该类的使用方法是:
SqlMapClient smcSqlMapClient = ....
PTLUserTrackDAOImpl implPTLUserTrackDAO = new PTLUserTrackDAOImpl(smcSqlMapClient);
// ...
PTLUserTrackExample expPTLUserTrackExample = new PTLUserTrackExample();
PTLUserTrackExample.Criteria criPTLUserTrackExample = expPTLUserTrackExample.createCriteria();
criPTLUserTrackExample.andUsernameLike("DavidHsing%");
expPTLUserTrackExample.or(criPTLUserTrackExample);
expPTLUserTrackExample.setOrderByClause("LoginDate desc, LoginTime desc");
List<PTLUserTrackSchema> lstPTLUserTrackSchema = implPTLUserTrackDAO.selectByExample(expPTLUserTrackExample);
System.out.println(lstPTLUserTrackSchema.size());
--转自
该贴由koei123转至本版2015-7-14 11:05:43