I work for a company who has an implementation that uses Eclipselink 2.6.2 and we are now trying to implement multi-tenancy. All of our tables currently have a discriminator field including our join tables. This is because we ship data between different data stores for sharding and it is much easier to do if that field exists in our join tables as well.
For example, object A and object B both have tenant_id. We have a many to many join table A_B that contains A_ID, B_ID and a tenant_id.
How should this be modeled such that Eclipselink will populate that tenant_id for us as well as the other two join fields? We would prefer not to create objects for AB if possible as we have a lot of these relationships now and the application currently does not manage the population of that tenant_id. In the past we have used source or target relation keys to ensure that this field is populated. However, with multi-tenancy, those are read only fields so that strategy fails.