-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Keep track of generated IDs for Client VOs
PostPosted: Sat Oct 07, 2006 4:40 pm 
Newbie

Joined: Sat Oct 07, 2006 4:34 pm
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.