ObjectDB ObjectDB

Multitenancy with discriminator



I have a very large business application that makes use of the Hibernate "Filters" feature and of the EclipseLink "Single Table Multitenancy with discriminator" feature in order to implement entities filtering based on a discriminator.

Here is an example of one of my business objects:

public class BusinessPartner {
    protected String id;
    protected Domain domain;

A domain is intended to be a discriminator by which filtering entities. The filtering feature also involved this other objects;

public class User {
    protected String id;
    protected Domain mainDomain;
    protected Set<Domain> otherDomains;

public class Domain {
    protected String id;
    protected Set<Domain> subDomains;

Here are some feature of the required filtering system:

  • a user that has "Enterprise 1" as "mainDomain" will be normally able to see entities belonging to the "Enterprise 1" domain
  • a User with no specified "mainDomain" will be able to see al entities (no filtering applied)
  • a user that has "Enterprise 1" as "mainDomain" but also have Enterprise 2"  in "otherDomains"  will be able to see BusinessPartners belonging to both "Enterprise 1" and "Enterprise 2" 
  • a user that has "Enterprise 3" as "mainDomain", with "Enterprise 3"  having "Dept 1", "Dept 2" as sub domains, will be able to see all entities of "Enterprise 3", "Dept 1" and "Dept 2"
  • a user that has "Dept 1" as "mainDomain" will be able to see all entities of "Dept 1" but NONE of "Enterprise 3" and "Dept 2"

So, all entities MUST reside in a single database. The ObjectDB query engine should be able to read some configuration data and when filtering is required for a given entity class it should add an extra "where" on the discriminator with a list of allowed value to ANY query performed by the database engine, be it implicit or explicit.

It's a non requirement to further extend this feature to entity collections: if one reaches a main object, no further filtering is required to filter its attribute collections. In other words, the filtered main entity can have collections containing object from various domain.

And the question is: do you plan to add a feature like Hibernate "Filters" or EclipseLink "Single Table Multitenancy with discriminator" to your very interesting product?



We would like to implement this feature in a future version. Meanwhile, filtering must be implemented by the application by modifying queries before submitting them to ObjectDB.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)


To post on this website please sign in.