-->
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: Problem w/ordering of Insertion into DB and Id Generation
PostPosted: Tue Feb 08, 2005 3:03 pm 
Regular
Regular

Joined: Tue Jan 11, 2005 8:55 pm
Posts: 53
Hi -

I currently have two objects: User and Item. A one-to-many relationship exists between User and Item; and furthermore, a User has a default item. So, User has a foreign key to Item (for the default item) and each Item has a foreign key to the User.

Now, I have a problem with inserting this data into the database - I am currently using seqhilo for ID generation. The problem is arising because I can't insert User first because it needs the Item ID, and vice versa.

I don't want to first insert each User and each Item, then associate the two, and then update the User and Item because that is clearly inefficient. How can I resolve this...?


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.