• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use of cascade option instead of bidirectional association

 
vijay jacob
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I understand we have lot of cascade option like save , update, delete. all .

My question is when we set a bidirectional association. If we save parent , the child arlready get saved right??

So we do not really need a cascasde option right?? I believe the delete also work the same way as save (bidirectional).


Please help me with this doubt.
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijay

My question is when we set a bidirectional association. If we save parent , the child arlready get saved right??


Not by default. If no cascade type is specified, no cascading will occur.



If this scenario, if A is saved, B is not and vice versa.
 
vijay jacob
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


So cascade By works only in bidirectional association.

So if no cascasde is given , does that it mean the assocaiton is only for fetching..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic