Hibernate Problem while cascading multiple one to many relationships
posted 3 years ago
I am not able to find out workaround of this issue.
Here is the case.
I am having hibernate xml mapping files for my tables.
I can add one-to-many relation in mapping and it works fine, but getting problem when child table has another one to many relationship.
Segment is parent table and it has country as a child table. so i join country as
Everything is defined and its working fine here.
but now country table has a child table of states (with one to many relationship) so at com.bhn.service.segment.Country table i have list of states
and in country.hbm.xml file , I define it as
but I guess till country_id gets inserted, it tries to save state and throws error that Null value found in Not null column.
Not sure how to implement this.. after this I have cities table also as child of state with one to many relationship, so i m not sure how to implement this.