Many-to-Many Relationships


EJB programming & troubleshooting: Many-to-Many Relationships

  1. Many-to-Many Relationships (1 messages)

    I'm trying figure out how to represent Many-to-Many in
    with EJBs. The underlying database contains a link table
    that has a PK of its own and additional information (a date/time field). Do I need a separate EJB to represent the link table? etc. etc.
    Does anyone know of articles or book chapters/sections dealing with this issue? Does anyone have experience with this problem.
    I am working with WebLogic 6.1


  2. Many-to-Many Relationships[ Go to top ]


    I would recommend either managing the link yourself or using a database trigger.

    If you use a trigger on the association table then it can insert and update the additional fields. IMHO I am never quite sure why people put a separate PK on association tables. I am sure there is some deep religous answer for this.

    If you manage the association yourself, use SQL in a DAO object. Do not create the overhead of another EJB. I think this is where a lot of people went wrong in EJB 1.1.