Announcement Announcement Module
Collapse
No announcement yet.
cascade type persists Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • cascade type persists

    I am using hibernate
    I have parent A and children b .


    I want just to save b when I save A and if a is deleted I don't want to delete b. So in A I specified CascaseType.Persisits,
    when I save A it does not save b and If I use cascadetype.all only then it saves b .


    I am surprised is this the usual behaviour or am I missing something for which cascadeType.Persists is not working ?

  • #2
    Originally posted by [email protected] View Post
    I am using hibernate
    I have parent A and children b .
    I want just to save b when I save A and if a is deleted I don't want to delete b. So in A I specified CascaseType.Persisits,
    when I save A it does not save b and If I use cascadetype.all only then it saves b .
    I am surprised is this the usual behaviour or am I missing something for which cascadeType.Persists is not working ?
    for your requirements the correct cascade is save-update.

    Comment


    • #3
      I am using annotations, what is equivalent to save-update ?

      Comment


      • #4
        Originally posted by [email protected] View Post
        I am using annotations, what is equivalent to save-update ?
        Code:
        @OneToMany(cascade = CascadeType.SAVE_UPDATE)

        Comment

        Working...
        X