Multitenancy not working?

Version Add-on: 2.0.0.BETA1
Version Studio: 13.0
Version Framework: v7.2.0

I’m trying to achieve a very simple example:

import com.haulmont.addon.sdbmt.entity.StandardTenantEntity;
import com.haulmont.chile.core.annotations.NamePattern;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

@Entity(name = "appatom_DocumentType")
public class DocumentType extends StandardTenantEntity {
    private static final long serialVersionUID = 1854489626758796679L;

    @Column(name = "NAME", nullable = false)
    protected String name;

    public String getName() {
        return name;

    public void setName(String name) { = name;
  1. Created a Admin User for the specific tenant
  2. Created a new tenant
  3. Created a standard browse/edit entity screen.
  4. Logged in with tenant user.

Problem is when adding a new document type it’s shown in screen a new entry in the browse screen.
When clicking refresh i see the entries disappear.
Looking at the entity inspector i see records getting created without the tenant ID.

Hello, @mrfloppy1980

Thanks for reporting the problem. We created an issue.


@shchienko Thank you for responding and creating the issue on github!

Is there a workaround available for this moment?

Hello, @mrfloppy1980

You need to add the listener:

public class MultitenacyEntityPersistingListener {

    protected TenantProvider tenantProvider;

    protected TenantEntityOperation tenantEntityOperation;

    public void beforePersist(EntityPersistingEvent event) {
        Entity entity = event.getEntity();
        String tenantId = tenantProvider.getCurrentUserTenantId();
        if ((entity instanceof HasTenant || entity instanceof TenantEntity) && !tenantId.equals(TenantProvider.NO_TENANT)) {
            tenantEntityOperation.setTenant(entity, tenantId);