Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • 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
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic