Beispiel #1
0
  @Test
  public void delete() {
    UserMapper sut = new UserMapper(dataSource(), new IntegerIdentityMap<User>());
    final User user = sut.find(2);
    assertThat(user.getId(), is(2));
    assertThat(user.getLoginName(), is("Bar"));
    assertThat(user.getHashedUserData(), is("043bd227eaa879d438e7c1dfea568bc9"));

    sut.delete(user);

    try {
      sut.find(2);
      fail("Expected exception not thrown!");
    } catch (DomainModelException ex) {
      assertThat(ex.getMessage(), is("There is no record set whith primary key '2'!"));
    }

    // avoid cache
    sut = new UserMapper(dataSource(), new IntegerIdentityMap<User>());

    try {
      sut.find(2);
      fail("Expected exception not thrown!");
    } catch (DomainModelException ex) {
      assertThat(ex.getMessage(), is("There is no record set whith primary key '2'!"));
    }
  }
 public void deleteAllByUidAndMid(long uid, long mid) {
   userContactMapper.delete(uid, mid);
   userExtMapper.delete(uid, mid);
   userLastActiveMappper.delete(uid, mid);
   userTagMapper.deleteUserTag(uid, mid);
   platformMapper.delete(uid, mid);
   userMapper.delete(uid, mid);
   memberExpRecordMapper.delete(uid, mid);
   memberPointRecordMapper.delete(uid, mid);
   addressMapper.deleteAll(mid);
   memberMapper.deleteMember(uid, mid);
 }