2 Replies Latest reply on Mar 25, 2006 10:42 AM by epbernard

    one-to-many unidirectional persistence does not create prima

    chornsey

      Please let me know if my assumption is valid or not.

      I have an entity bean named parent which has an autogenerated id.
      I also have another entity bean named child which has an auto generated id.

      The parent object has a list of child objects mapped as one-to-many in the parent with parent being the mappedby class.

      I expect when i create a new parent then add two newly created children to the list, that when I persist parent, jboss will generate the id for parent then populate the foriegn key fields in the children classes with the newly created id of the parent. Then the children will be saved with the correct parent id.

      This is not what actually happens though. As far as I can tell JBoss does not update the children with the parents id at all. I leaves the foreign key to the parent alone, expecting that you will populate it.

      Can anyone expand on how the system should behave in this case, or point me to the documentation that details this situation.

      Thanks for any help.