I am not able to create one-to-one relation JPA.
When I run the program, I am getting following error:
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AI" and "Latin1_General_BIN" in the equal to operation.
@Entity
@Table(name = "EMPLOYEE")
public class Employee {
@Column(name = "EMPID")
@Id
private String empid;
@Column(name = "COMPANYID")
private String companyid;
@Column(name = "NAME")
private String name;
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "ADDRESSID", referencedColumnName = "ADDID")
private EmployeeCommunication empcomm;
public Employee() {
}
setters and getters
}
@Entity
@Table(name = "EMPLOYEECOMUNICATION")
public class EmployeeCommunication {
@Column(name = "ADDID")
@Id
private String empadid;
@Column(name = "PHONE")
private String phone;
@Column(name = "EMAIL")
private String Email;
@OneToOne(mappedBy = "empcomm")
private Employee employee;
public EmployeeCommunication(){
}
setters and getters
}
I tried multiple ways, but I am not able to succeed.
How do I to create a one-to-one mapping using JPA and Spring-boot?