• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cascade Save

 
sridhar skrishnan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello guys,

Am back again with another problem. Say, I have 2 tables A and B with a one-to-many association from A to B. I want to add insert a record into B which involves inserting a Dummy record into A. Can anyone tell me how to go about it? Would I be able to do a cascade save?

i tried adding object B to Object A as a HashSet and then saving A. But it didnt work. The record was inserted in A but the corresponding record was not saved in B.

Some Pointers will be really helpful. Will put across my code and mapping files if needed.

Thanks,
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When mapping relationships, there is an attribute called cascade, I suggest using cascade="all" for now.

Mark
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!