how to make relation between a many to many join table and one persistent class?

2 posts, 0 answers
  1. amir sherafatian
    amir sherafatian avatar
    42 posts
    Member since:
    Aug 2009

    Posted 14 Sep 2009 Link to this post

    hi
    i have two persistent class with name : persons and jobs and the resault of their many-to-many relations is a join table with name PersonJob in my database
    and now i want to make a many-to-many relation between PersonJob and another one persistent class with name Roles
    for this i think , i must have that join table (PersonJob) as a object class in my application to declare a collection of Roles class in it
    and declare a collection of join table (PersonJob) to Roles Class
    how can i do this ?
    how to make relation between a many to many join table and one persistent class?
  2. TSE
    TSE avatar
    381 posts
    Member since:
    Sep 2008

    Posted 14 Sep 2009 Link to this post

    Hi Amir,

    I think you're on the right way...

    In my opinion you need a JobPerson class (not a table since you already have this generated by OA - namely the join_table)
    On this class, you'll have a reference to the Job, Person and the Roles classes. So in fact you're putting in an intermidiator class to hold the "extra" reference on the join table.
    I think I remember an exact example of doing this in either the knowledge base or in the docs..check them

    regards

    Henrik
  3. DevCraft banner
Back to Top