Container Managed Relationships query
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Raj_Subramani
Posted On:   Sunday, August 1, 2004 02:34 PM

My query is with respect to JBoss but I suspect it could apply to other containers as well. I have a simple many~to~many relationship. Person and Org have a many to many (bi-directional) relationship. In the DB this is managed by a Person_Org_List table. Primary key for Person table is person_id. Primary key for Org table is org_id. Obviously primary key for Person_Org_List table is person_id & org_id. Person | | ^ Person_Org_List v | | Org However Person_Org_List (apart from the 2 foreign keys person_id and org_id) has an additonal (non-primary) field called designation.    More>>

My query is with respect to JBoss but I suspect it could apply to other containers as well.



I have a simple many~to~many relationship.

Person and Org have a many to many (bi-directional) relationship. In the DB this is managed by a Person_Org_List table.

Primary key for Person table is person_id.

Primary key for Org table is org_id.


Obviously primary key for Person_Org_List table is person_id & org_id.



			
Person
|
|
^
Person_Org_List
v
|
|
Org



However Person_Org_List (apart from the 2 foreign keys person_id and org_id) has an additonal (non-primary) field called designation.



I got JBoss (3.2.5) to manage this many-to-many relationship with



However, when I add an org to a person I notice that only the org_id and person_id appear in Person_Org_List table in the DB (which is expected).



But this means I can never get hold of the designation column in that table.




Does this mean that I must create a PersonOrgList entity and map Person entity as a one-to-many with PersonOrgList entity and similarly Org entity as a one-to-many with PersonOrgList entity?



Cheers
-raj

   <<Less
About | Sitemap | Contact