-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
I made a ticket for this in Cuba forum before https://www.cuba-platform.com/discuss/t/bug-in-multitenancy-queries-tenant-id-no-tenant-is-applied-incorrectly/14547
@Override
public String getAdditionalCriteria(Class entityClass) {
MetaProperty metaProperty = tenantEntityOperation.getTenantMetaProperty(entityClass);
return String.format("(:tenantId = '%s' or this.%s = :tenantId)", TenantProvider.NO_TENANT, metaProperty.getName());
}
should be replaced by
@Override
public String getAdditionalCriteria(Class entityClass) {
MetaProperty metaProperty = tenantEntityOperation.getTenantMetaProperty(entityClass);
return String.format("(this.%s = '%s' or this.%s = :tenantId)", metaProperty.getName(), TenantProvider.NO_TENANT, metaProperty.getName());
}
However, during startup an anonymous login is mandatory. In the as is this results in a condition on the query
Copy
'no_tenant' = 'no_tenant'
after applying the fix we get
Copy
t1.TENANT_ID = 'no_tenant'
As the anonymous user has a null value in the tenant_id the condition returns false. no anymous user is found and the server fails to start.
Metadata
Metadata
Assignees
Labels
No labels