title: How to implement a 3 Many-to-Many relationship with Hibernate?
body: <p>I'm not 100% sure this is only a Hibernate issue as this might be a more abstract decision but I'll give it a try.<br>
  Since the problem description is a bit lengthy I'll first state that what I'd like to do is see if I can change the implementation to something which more resembles a Best practice implementation then this.</p>
  
  <p>I have 3 entities, relevant to this issue: Workstation (ws), Employee and Organization-unit(org-unit).<br>
  An Employee can belong to one org-unit.<br>
  An Org-unit can hold many employees.<br>
  A Workstation is used to display data of an Org-unit(in general), Of an Org-unit and a specific employee in it and an employee which does not belong to an org-unit.</p>
  
  <p>Currently, for various reasons which <strong>were</strong> out of my control, we do not use any associations between the entities in Hibernate or via DB-Constraints but we just use Columns which logically serve as Foreign-Keys.<br>
  We currently have an additional table which has 4 columns:Id,WSId,EmployeeId,OrgUnitId.<br>
  This allows a WS to refer to an orgunit (where employeeId is null),to an employee without an org-unit (orgunitId is null) or to an employee and org-unit (where none are null).</p>
  
  <p>I'd like to be able to know:<br>
  1.Given a WS, which employees is it following and which org-units and how (i.e., alone, with an employee? which?)<br>
  2.Given an employee, which WS are monitoring it.<br>
  3.Given an org-unit, which WS are monitoring it and how (i.e., alone, with an employee? which?)<br>
  This issues relates to the Presentation layer as it dictates the view will be generated BUT it is a part of the domain model as a user, will use, an interface to manipulate these monitoring mappings and so these mappings are a part of the domain model.</p>
  
  <p>I'm not sure if what I have is not the least evil among options, and I would greatly appreciate comments and suggestions.</p>
  
  <p><strong>EDIT</strong> From one of the answers I think it is not clear enough that a WS can display data for many such mappings at the same time, in a mixture of the above sorts (org-unit, employee etc.)</p>