Error modifying an entity in springboot : Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) :

In my spring boot application, I have an employe entity and a user entity , that are practically the same , just user has email and password so this entity is used only for authentication but this user references a specific employe so in database table user (id,email,password,employe_id) and employe(id,fname,lname,email,password,….,user_id) , and employe can be a manager or HR or just a simple employe so those are the role(id,role_name) and to associate each user with a role there is a join table user_role(user_id,role_id) , so this is my database structure now I am having issues when modifying information of an employee , changing the other fields goes normal but when it comes to changing role,which requires to delete a user then create a user with a different role then associate it with the modified employe :
this is the method that returns that error

 @Transactional
   public void modifyEmployee(Long id, String nom, String prenom, 
  String email, String  motdepass
         Departement departement, Long solde, String role) throws 
     EmployeExistException {
         Employe employe = emp.findById(id)
         .orElseThrow(() -> new NoSuchElementException("Employee not 
  found with ID: " + id));

         // Update employee details
         if (nom != null) employe.setNom(nom);
         if (prenom != null) employe.setPrenom(prenom);
         if (email != null) employe.setEmail(email);
         if (motdepass != null) employe.setMotdepass(motdepass);
         if (departement != null) employe.setDepartement(departement);
         if (solde != null) employe.setSoldeconge(solde);

         // Check if a role change is requested
         if (role != null) {
             User oldUser = employe.getUser();
             if (oldUser != null) {
                 userRepository.delete(oldUser);

                 System.out.println("Deleted old user");
             }

             // Create a new user with the specified role
             User newUser = createUserWithRole(employe, role);
             employe.setUser(newUser);
             System.out.println("Created new user with role: " + role);
         }

         // Save the modified employee
         emp.save(employe);
     }

User :

 @Table(name = "users", 
  uniqueConstraints = { 
    @UniqueConstraint(columnNames = "username"),
    @UniqueConstraint(columnNames = "email") 
})
  public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@NotBlank
@Size(max = 50)
@Email
 private String email;

 @NotBlank
 @Size(max = 120)
 private String password;

@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(  name = "user_roles", 
    joinColumns = @JoinColumn(name = "user_id"), 
    inverseJoinColumns = @JoinColumn(name = "role_id"))

 private Set<Role> roles = new HashSet<>();
 @OneToOne(mappedBy = "user", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
 private Employe employe;

Employe :

public class Employe {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    protected Long id;
    protected String nom;
    protected String prenom;
    protected String email;
    protected String motdepass;
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "departement")
    protected Departement departement;
    protected Long soldeconge;
    @OneToMany(mappedBy = "emp", cascade = CascadeType.ALL)
    protected List<Demande> demandes;
    @OneToMany(mappedBy = "emp", cascade = CascadeType.ALL)
    protected List<Conge> conges;
    protected LocalDate created_at;
    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id")
    private User user;

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật