Hello,
The question pertains to a save operation on a new object (Page) which consists of several objects (Samples).
Presently, this is the route I am taking:
1. Assign temporary ID to the page and each of its samples.
2. Convert the client-value objects to its corresponding model value objects.
3. Set the relationship within the value objects.
4. Invoke save on the Page, which will also save all the samples within.
So far things are working fine; the save operation functions smoothly and the inserts occur as expected.
Now, I need to assign the newly generated ID's for the page and the samples in the client-side value objects.
The problem here is that since the entire insert (for the page and all its samples) occurs at a go, I am at a loss to keep track as to which of the newly generated ID goes where. The temporary ID's seem to lose their significance given that I am not going and saving each sample individually.
Had I been saving each of the samples in, say, a for-loop it would have been easy for me to map the temporary Id with the corresponding newly-generated ID. But wouldn't this be bad design?
Thanks,
Saket
|