Dear Sir/Madam,
I have a database schema with one table assoicate with another table.
Thus, I use the Parent and Child relationship according to the document stated in which Parent has a Collection Set of child. It worked fine in select statement. For Business requirement, the pk for both value must be application assigned. Thus, my pk generated is used "assigned" in the generator element. However, when I set to this, if I instantiate a new Parent with a new Child in the Parent's Collection Set, the Parent will be inserted but the Child is only do updated which is not expected. I found that I set the id of unsaved-value to null. When I change to unsaved-value to "any", the application will insert both new Parent and new Child. However, another problem come out, when I try to update a Parent together with a updated Child in the Parent Collection Set, the Parent will be updated but the Child will be inserted and that is not expected.
Thus, please help if I use generate key is "assigned", what need to be put in unsaved-value to make insert and update in a right manner or what recommendation I need to take.
Thanks in advance
|