• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

foreign key in primary key

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
There will be plenty of time to discuss your objections when and if you return. The cargo is this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic