2 Replies Latest reply on Jun 21, 2002 4:06 AM by Vesa Varimo

    Complex many-to-many relations.

    Vesa Varimo Newbie

      Hi!

      I have a database model which I'm trying to convert to entity beans. I have four tables in the model:

      Project
      -------
      +projectId (pk)
      +projectName

      Organisation
      ------------
      +organisationId (pk)
      +organisationName

      ProjectOrganisation
      -------------------
      +projectOrganisationId (pk)
      +projectId (fk)
      +organisationId (fk)
      +sapNumber

      ProjectOrganisationCost
      -----------
      +projectCostId (pk)
      +projectOrganisationId (fk)
      +cost

      I have tried to create entity beans:

      ProjectEJB, ProjectCostEJB, OrganisationEJB and ProjectOrganisationEJB.

      I'm having serious problems when I map ProjectOrganisation
      with relation-table-mapping in jboss cmp to get many-to-many relation from Person to Organisation work. I have to map ProjectOrganisation also with foreign key mapping to Project and Organisation using ProjectOrganisationId because I need to get a reference to ProjectOrganisationEJB from PersonEJB.

      How should I model this kind of database model to ejbs so that relations would work?

      Thanks for your help,

      Vesa