[javaee-spec users] Re: [jsr342-experts] proposal for Tenant ID

From: Bill Shannon <>
Date: Wed, 25 Jan 2012 14:52:30 -0800

Pete Muir wrote on 01/25/12 03:48:
> Bill,
> It's not clear from the proposal what the *type* of the tenant id would be.
> I'm going to assume it's of type String for the discussion below.

Yes, although we'll probably need to say something about the characters
allowed in the string and the maximum length of the string.

> Assuming that this is cleared up, and the JNDI option was taken, we could
> update the CDI spec to allow injection of the tenant ID. For example, CDI
> could define the qualifier @TenantId, allowing the tenant to be injected via
> @Inject @TenantId String tenantId;. I would suggest specifying this in CDI
> 3.6 where we allow injection of other Java EE objects which are available in
> JNDI, using language like:
> "a bean with bean type java.lang.String with qualifier @TenantId allowing
> injection of the current Tenant ID" (I would also need to adjust the
> surrounding language as the qualifier @Default is specified in the preamble,
> but that is not hard).

For EE 7 we've taken a very simple approach to multi-tenant applications
that means each tenant gets its own instance of the application.

For EE 8 we'll need to consider whether we should support a model in
which multiple tenants share a single application instance. Obviously
there are many issues with this, and it may turn out to not be feasible,

If multiple tenants share an application instance, the tenant ID will
need to be different per thread, and thus injecting the tenant ID isn't
going to work well.

For that reason I'm hesitant to define injection of the tenant ID until
we have more experience with multi-tenant applications.