-->
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.  [ 4 posts ] 
Author Message
 Post subject: IDBAG with two relations
PostPosted: Thu Aug 16, 2007 3:10 am 
Beginner
Beginner

Joined: Mon Jul 30, 2007 4:58 pm
Posts: 21
Here's my domain model:

A User has many Transactions. A Portfoilo also has many Transactions. The relations are one to many and unidirectional. Traversing from Transaction to a User or Portfoilo is unnecessary. Transaction table has two foreign keys to each of the User and Porfoilo Table.

The problem is I am trying to make the mapping as IDBAG. (Since BAGs are not nice when inverse = false). My question is :

Is it safe to use the PK of Transaction table to use as a surrogate key for both of the User and Portfoilo IDBAG mappings ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 16, 2007 4:20 am 
Beginner
Beginner

Joined: Sat Jan 14, 2006 10:05 am
Posts: 22
Location: spb.ru
It seems reasonable.
Do you have problems with this solution?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 16, 2007 7:15 am 
Beginner
Beginner

Joined: Mon Jul 30, 2007 4:58 pm
Posts: 21
Yes. The thing is PK is autogenerated by the Transaction Entity.

Do I have to use a generator from parent even the child generates its own PK and that PK used as a surrogate key ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 16, 2007 7:22 am 
Beginner
Beginner

Joined: Mon Jul 30, 2007 4:58 pm
Posts: 21
Can someone show me how to map basic idbag for complex object of parent and children ?


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

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.