Results 1 to 2 of 2

Thread: save operation on persistant parent and transient child

  1. #1

    Default save operation on persistant parent and transient child

    I have parent and child with cascade all . In my case I open session, load the parent create a new child (this is transient) and add this child to parent and call save , I was hoping that hibernate would generate the PK for the newly added child , but it did not , it is generating only after flush ,and I if I want to use the PK of this child for some other operation before flush I canot , I want hibernate to generate the PK of the child with call to save on persistant parent , please tell me how to do this ?

  2. #2

    Default

    Please help me with this. I also posted this in hibernate forums , but the hibernate forums is more towards commercial support they rarely try to help , unless i go for commercial support ,please help me.

    Quote Originally Posted by miroconnect@yahoo.com View Post
    I have parent and child with cascade all . In my case I open session, load the parent create a new child (this is transient) and add this child to parent and call save , I was hoping that hibernate would generate the PK for the newly added child , but it did not , it is generating only after flush ,and I if I want to use the PK of this child for some other operation before flush I canot , I want hibernate to generate the PK of the child with call to save on persistant parent , please tell me how to do this ?

Posting Permissions

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