Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

foreign key in primary key  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
my prob:
I have two table in my database : Directory and directory_user_right:
directory : id = primary key
other fields
directory_user_right: (dir_id + UID)= primary key
dir_id is also a foreign key from directory.
ejb-jar:
<ejb-relation>
<ejb-relation-name>Directory-DirectoryUserRight</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>Directory-contents-DirectoryUserRight</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<ejb-name>DirectoryEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>directoryUserRight</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>DirectoryUserRight-are-in-directory</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>DirectoryUserRightEJB</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
bean:
public DirectoryGroupRightPK ejbCreate(String group, String right) throws CreateException{
//no setDirid because CMR read only
setGroup(group);
setRight(right);
return new DirectoryGroupRightPK(getDirId(), group,right);
}
And I have an error that all fields of primary key must be set
Someone has an Idea (a pattern?) to solve this problem?
thx
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!