Following is composite key:
@Embeddable
public class EmployeePK implements Serializable {
private static final long serialVersionUID = 1L;
@Basic(optional = false)
@Column(name = "EMPLOYEEID")
private String employeeId;
@Basic(optional = false)
@Column(name = "ROLEID")
private Character roleId;
@Basic(optional = false)
@Column(name = "COMPANYID")
private String companyId = new String("0");
We already have a row in database with company ID - 100
When i try to update setCompanyId(125) in hibernate loaded object and use MERGE, It creates another row in table instead of updating previous.
Is it possible to avoid creating duplicate row and keep that particular row only? Or do we need to delete and reinsert the same?