Results 1 to 4 of 4

Thread: cascade type persists

  1. #1

    Default 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. #2
    Join Date
    Nov 2007
    Posts
    420

    Default

    Quote Originally Posted by miroconnect@yahoo.com 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.

  3. #3

    Default

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

  4. #4
    Join Date
    Nov 2007
    Posts
    420

    Default

    Quote Originally Posted by miroconnect@yahoo.com View Post
    I am using annotations, what is equivalent to save-update ?
    Code:
    @OneToMany(cascade = CascadeType.SAVE_UPDATE)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •