title: Database design with JPA OneToMany with EmbeddedId?
body: <p>i have an issue (maybe only in my head :-)) with some Database-Design JPA related stuff. I want to have the following:</p>
  <p>Permission table:</p>
  <ul>
  <li>ProjectId</li>
  <li>UserId</li>
  </ul>
  <p>This table should have an entry for each user and each project the user has permission to. Example:
  ProjectId1 - user1
  ProjectId1 - user2
  ProjectId2 - user1</p>
  <p>For sure, i also have a project table with the projectId as Primary Key. And i want to have a OneToMany dependency to the permission table.</p>
  <p>What i do not want to do is to have a generated ID in the permissions table. As far as i know this can be solved with an EmbeddedId.</p>
  <p>Using an EmbeddedId, i could not get a OneToMany or ManyToMany dependency to work. I tried a lot of stuff but in the end i am not sure if this is maybe the wrong way to go?</p>
  <p>What worked was to have a generatedId in the Permissions table, but i think this should not be needed, or?</p>
  <p>Thanks in advance</p>