Multi Tenancy : find fails with a NPE on DN 2.5.6


stephane
 

I'm trying to use datanucleus.TenantReadIds at the EntityManager level, setting this property entityManager.setProperty(PropertyNames.PROPERTY_MAPPING_TENANT_READ_IDS, tenant);

As it doesn't seems applied, I look at PersistenceNucleusContextImpl:getMultiTenancyReadIds

public String[] getMultiTenancyReadIds(ExecutionContext ec)
{
if (multiTenancyProvider != null)
{
String[] tenantReadIds = multiTenancyProvider.getTenantReadIds(ec);
return (tenantReadIds != null) ? tenantReadIds : new String[] {multiTenancyProvider.getTenantId(ec)};
}

String readIds = config.getStringProperty(PropertyNames.PROPERTY_MAPPING_TENANT_READ_IDS);
if (readIds != null)
{
// Return the tenant read ids if defined (for context)
return readIds.split(",");
}

// Fallback to just the current tenant id for this execution context
return new String[] {ec.getStringProperty(PropertyNames.PROPERTY_MAPPING_TENANT_ID)};
}

Is it possible to read the PROPERTY_MAPPING_TENANT_READ_IDS from the EntityManger settings before doing the fallback ? 

thanks,
--
Stephane

Join main@datanucleus.groups.io to automatically receive all group messages.