I am getting following exception while updating employee object
org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.orbitbenefits.model.core.EmployeePartner.id
NOTE: I am doing one to one mapping based on common primary key
Can anyone help please?
Sample Code:
Code:
SuppressWarnings("JpaDataSourceORMInspection")
@Entity
@Table(name = "employee")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@UniqueUsername(groups = AllChecks.class)
public class Employee extends Person {
private Person partner;
@Id
@Column(name = "employee_id")
@Override
public Long getId() {
return super.getId();
}
@OneToOne(targetEntity = EmployeePartner.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
@JoinColumn(name = "employee_id")
public Person getPartner(){
return partner
}
@Entity
@Table(name = "employee_partner")
public class EmployeePartner extends Person {
@Id
@Column(name = "employee_id")
@Override
public Long getId() {
return super.getId();
}
@Column(name = "surname", nullable = false)
@Override
public String getSurname() {
return super.getSurname();
}
@Column(name = "firstname")
@Override
public String getFirstname() {
return super.getFirstname();
}
@Column(name = "middle_initials")
@Override
public String getMiddleInitials() {
return super.getMiddleInitials();
}
@Column(name = "title")
@Override
public String getTitle() {
return super.getTitle();
}
@Column(name = "date_of_birth", nullable = false)
@Override
public Date getDateOfBirth() {
return super.getDateOfBirth();
}
@Type(type = "com.orbitbenefits.util.hibernate.GenderType")
@Column(name = "gender", nullable = false)
@Override
public Gender getGender() {
return super.getGender();
}
@Column(name = "relationship_code", nullable = false)
public String getRelationshipCode() {
return super.getRelationship().getCode();
}
}