assertEquals(entity.getLoginName(), "update login name");
}
@Test
public void testSaveAll() {
User entity1 = new User();
entity1.setCreateTime(new Date());
entity1.setLoginName("test");
entity1.setPassword("123456");
entity1.setPinyinCode("pinyin");
entity1.setRealName("测试");
entity1.setState(new Integer(1));
entity1.setWubiCode("wubi");
User entity2 = new User();
entity2.setCreateTime(new Date());
entity2.setLoginName("test");
entity2.setPassword("123456");
entity2.setPinyinCode("pinyin");
entity2.setRealName("测试");
entity2.setState(new Integer(1));
entity2.setWubiCode("wubi");
List<User> data = Lists.newArrayList(entity1,entity2);
int before = countRowsInTable("TB_ACCOUNT_USER");
userDao.saveAll(data);
sessionFactory.getCurrentSession().flush();
int after = countRowsInTable("TB_ACCOUNT_USER");
assertEquals(before + 2, after);
entity1.setLoginName("update user 1 login name");
entity2.setLoginName("update user 2 login name");
userDao.saveAll(data);
entity1 = userDao.load(entity1.getId());
entity2 = userDao.load(entity2.getId());
assertEquals(entity1.getLoginName(), "update user 1 login name");
assertEquals(entity2.getLoginName(), "update user 2 login name");
}