Beispiel #1
0
  @Test
  @ExpectedDataSet
  public void update() throws Exception {
    User user = new User();
    user.setId(1);
    user.setUsername("nimda");
    user.setPassword("nimda");
    Role role = new Role();
    role.setId(1);
    user.setRoles(Collections.singleton(role));

    userDao.update(user);
  }
 /**
  * Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity
  * context.
  */
 public void update() {
   if (myDao == null) {
     throw new DaoException("Entity is detached from DAO context");
   }
   myDao.update(this);
 }
 protected void upgradeLevel(User user) {
   user.upgradeLevel();
   userDao.update(user);
 }