• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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
 
He was giving me directions and I was powerless to resist. I cannot resist this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic