コード例 #1
0
 @Transactional
 @Override
 public UserDto update(UserDto userDto) {
   if (userDto == null) {
     throw new NullPointerException();
   }
   User user = userConverter.userDtoToEntity(userDto);
   UserRole userRole = userRoleDao.findByUser(user);
   userRole.setRole(userDto.getRole());
   userRoleDao.update(userRole);
   return userConverter.userEntityToDto(userDao.update(user));
 }
コード例 #2
0
 @Transactional
 @Override
 public long save(UserDto userDto) {
   if (userDto == null) {
     throw new NullPointerException();
   }
   UserRole userRole = new UserRole();
   User user = userConverter.userDtoToEntity(userDto);
   userRole.setUser(user);
   userRole.setRole(userDto.getRole());
   Long id = userDao.save(user);
   userRoleDao.save(userRole);
   return id;
 }