@Transactional public RoleDTO save(RoleDTO dto){
  if (dto == null) {
    return null;
  }
  Role role;
  if (dto.isIdSet()) {
    role=roleRepository.findOne(dto.id);
  }
 else {
    role=new Role();
  }
  role.setRoleName(dto.roleName);
  return toDTO(roleRepository.save(role));
}

@ Transactional public RoleDTO save ( RoleDTO dto ) { if ( dto == null ) { return null ; } Role role ; if ( dto . isIdSet ( ) ) { role = roleRepository . findOne ( dto . id ) ; } else { role = new Role ( ) ; } role . setRoleName ( dto . roleName ) ; return toDTO ( roleRepository . save ( role ) ) ; }
save the passed dto as a new entity or update the corresponding entity if any .
