예제 #1
0
 @Test
 public void testGet() {
   String sql = "select * from t_user tu where tu.cname=:cname";
   Map<String, Object> params = new HashMap<String, Object>();
   params.put("cname", "张扬");
   User user = smartJdbcTemplate.get(sql, params, User.class);
   Assert.assertEquals("zhangyang", user.getCcode());
 }
예제 #2
0
 @Test
 public void testFindList() {
   String sql = "select * from t_user tu";
   Map<String, Object> params = new HashMap<String, Object>();
   List<User> users = smartJdbcTemplate.findList(sql, params, User.class);
   for (User u : users) {
     System.out.format("用户名称:%s,用户代码:%s\n", u.getCname(), u.getCcode());
   }
   Assert.assertEquals(true, users.size() > 0);
 }