public void testUpdatePass2Md5() { GeneralCriteria criteria = new GeneralCriteria(User.class); GeneralCriteriaResult<User> result = criteria.executeQuery(); for (User u : result.getData()) { u.setPassword(MD5Util.encode(u.getPuk())); criteria.getCriteriaQuery().update(u); System.out.println("更新MD5:" + u.getPassword()); } }
public void testSave() { User u = new User(); u.setActiveTime(new Date()); u.setAddress("dsfdsf"); u.setBindIP("110"); u.setDisabled(false); u.setStatus("11"); u.setUsername("username"); u.setRadPolicyId("11"); u.setPassword("pwd"); u.setPuk("puk"); u.setJoinTime(new Date()); u.setExpiredTime(new Date()); u.setSumFee(1000L); UserService service = (UserService) this.getCtx().getBean("manage.UserService"); service.save(u); }