Hi All,
I have a one to one bidirectional mapping between Car and Registration.
I have used Many to One element on Registration side, with unique="true", instead of using One-One element.
When I say
I get an exception
not-null property references a null or transient value: com.hibertut.beans.RegistrationDetails.car
But If i use session.persist(registration), it is inserting records in both car and registration table.
What is the difference? and why an exception in earlier case? Which one is preferred over other.
Also, how do I use one-one element instead of Many-one element in defining the mapping.
Thanks
I have a one to one bidirectional mapping between Car and Registration.
I have used Many to One element on Registration side, with unique="true", instead of using One-One element.
When I say
I get an exception
not-null property references a null or transient value: com.hibertut.beans.RegistrationDetails.car
But If i use session.persist(registration), it is inserting records in both car and registration table.
What is the difference? and why an exception in earlier case? Which one is preferred over other.
Also, how do I use one-one element instead of Many-one element in defining the mapping.
Thanks