Issue
@Entity
@Table(name="tbl_name")
public class Test extends BaseEntity {
@OneToOne( fetch = FetchType.LAZY)
@JoinColumn(name = "ALL_ORG_MST_SECTION_ID",nullable = true)
private AllOrgMst allOrgMstSection;
@OneToOne(fetch = FetchType.LAZY )
@JoinColumn(name = "ALL_ORG_MST_SUB_SECTION_ID",nullable = true)
private AllOrgMst allOrgMstSubSection;
}
This is the model . when I insert this model one object is null value then show me the error
Post man Object pass
{
"allOrgMstSection": {
"id": 23
},
"allOrgMstSubSection": {
"id": null
}
}
@Autowired
private TestRepository testRepository;
@Override
public Test save2(Test entity) {
return testRepository.save(entity);
}
In baseEntity have the Id
Solution
just simply soled the issue
{
"allOrgMstSection": {
"id": 23
},
"allOrgMstSubSection": null,
}
Answered By - Bulbul Ahmed