• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate Problem while cascading multiple one to many relationships

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

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.
e.g.
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.

Thanks in advance


 
reply
    Bookmark Topic Watch Topic
  • New Topic