Application Settings add-on with Multitenancy

Hi,

Is it possible to use the Application Settings and Multitenancy add-on together in a Jmix 2.x project?
In other words, can application settings be created per tenant?

Thanks,
Peter

Hi!

Since you create entities for ApplicationSettings yourself, you can independently implement multitenancy support for such entities. To do this, you will need to add an additional sysTenantID attribute.


    // ....

    @TenantId
    @Column(name = "SYS_TENANT_ID")
    protected String sysTenantId;

    public String getSysTenantId() {
        return sysTenantId;
    }

    public void setSysTenantId(String sysTenantId) {
        this.sysTenantId = sysTenantId;
    }

    // ....

Thus, when saving this entity, the sysTenantId field will be set to the tenantId of the current user.
Then, when you load an YourApplicationSettings entity from the database for an authenticated user, only the settings for the corresponding tenant will be loaded.

UPD:
You can see an example of an entity that supports multitenancy here:
io.jmix.flowuidata.entity.FilterConfiguration


Documentation sources: Multitenancy :: Jmix Documentation

Best regards,
Dmitriy

Hi Dmitriy,

Thanks for the quick response. Then we stick to our own implementation and do not use the Application Settings addon.
As far as I can see, the Report addon supports it by default, there is already a SYS_TENANT_ID field in the Report table.
Are you planning to make the Application Settings addon work with the Multitenancy addon “out of the box” in the future?

Thanks,
Peter

I will discuss this issue with my colleagues at the next meeting. Thanks for the idea!

Regards,
Dmitriy