This is the relation
JavaScript
x
@OneToOne(optional = true, fetch = FetchType.LAZY, cascade = CascadeType.PERSIST )
@JoinColumn(name = "ALL_ORG_MST_ORGANIZATION_ID")
private AllOrgMst allOrgMstOrganizationId;
And postman Object Data
JavaScript
{
"empSts": "Active",
"empRef": null,
"probationDuration": "6",
"allOrgMstGroupId": {
"id": 1
},
"allOrgMstOrganizationId": {
"id": null
}
}
I can not insert null value .If I give the AllOrgMstOrganizationId then no problem.But when I give it Null Then Error::org.springframework.dao.InvalidDataAccessApiUsageException: detached entity passed to persist: com.hrms.entity.com.AllOrgMst; nested exception is org.hibernate.PersistentObjectException: detached entity passed to persist: com.hrms.entity.com.AllOrgMst
Advertisement
Answer
Simple Solutions
JavaScript
{
"empSts": "Active",
"empRef": null,
"probationDuration": "6",
"allOrgMstGroupId": {
"id": 1
},
"allOrgMstOrganizationId": null
}