• 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

Cascade Save Not Working

 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So I have two domain classes set up in a one-to-many relationship - class A has a list of class B's. For some reason, when I add a new instance of class B to the list in class A, that instance of B is not being persisted when I save my class A. Here are my mappings:

Class A


Class B


I can save the instance of B directly and that works but, if I try to save A, even though it has a reference to B, B doesn't get saved.

As an aside, when I look at these objects through the debugger, I can verify that A does contain a reference to B in its list and that B does have a reference to A, so the bi-directional relationships appear to be set up correctly.

Any ideas on what I have wrong, here?

Thanks.
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, you'll want to persist both sides of the relationship.

-Cameron McKenzie
 
reply
    Bookmark Topic Watch Topic
  • New Topic