I am working with spring
hibernate
project where a model has a foreign key
which mapped with @joincolumn
as shown below.
class Customer
{
@JoinColumn(name="CUSTOMER_RM_ID",nullable=true)
@OneToOne(fetch=FetchType.EAGER)
private RmSm customerRMId;
}
But, while saving this entity from angular js UI, via rest api, i am getting below mentioned exception.
Request:
{"customerRMId":{
"id":null
}
}
I have removed all other fields from the model and the request as well, for the readability purpose.
Exception:
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing:
What is the solution for this, I have tried with hibernate nullable
true option. But didn't work!