Adding MultiTenancy

Just having a play with the MultiTenancy Addon.

So I have followed instuctions here:

Just wondering, is the tenant automatically assigned to the creation of a new entity aswell? This is not happening for me…
i.e. I have created a new entity

public class MyEntity implements AcceptsTenant {
@Column(name = "ID", nullable = false)
private UUID id;

@Column(name = "TENANT_ID")
protected String tenantId;

But if I create a new entity logged in as a certain tenant the tenant id is not added.
Also any user can see any of these entities -> they are not being filtered by tenant.

Am i missing another interface or something?

Hi @daryn

Did you add an attribute

   @Column(name = "TENANT_ID")
   protected String tenantId;

to the User entity as described here?

Also have a look to the sample project with multitenancy add-on.


Actually, silly me.

Had not created setter for tenantId in User class.

Might be a good idea to add to documentation for those like me who follow instuctions with minimal thinking :smiley: