Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-dev] Multi-tenant using shared schema doc

The annotations should be separate and the XML should be embedded. I believe this is a common pattern in JPA.

Doug

On 2011-03-15, at 8:36 AM, Guy Pelletier <guy.pelletier@xxxxxxxxxx> wrote:

Well I got confused since in the XML (from previous discussions and examples) the tenant discriminators were within <multitenant> so I was trying to be consistent. The XML should be separated as well then?

I was thinking within the same annotation would be cleaner and mimic things DiscriminatorColumn where length only applies when the type is STRING.

Just to work through having the metadata separate though, means our minimal configuration can be one of the three:

- @Multitenant
- @TenantDiscriminator
- @TenantDiscriminators

Then further expanded when we add support for TABLE_PER_TENANT
- @TenantTableDiscriminator(??)

Or is it intended that all entities that use multi-tenancy must at least declare @Multitenant (again I'm working from previous discussions and examples)

Cheers,
Guy


On 14/03/2011 8:06 PM, douglas clarke wrote:
Guy,

Looking at the example:
@Entity
@Table(name=“EMP”)
@Multitenant(
  type = SINGLE_TABLE,
  tenantDiscriminators = @TenantDiscriminator(name=“tenant-id”, columnName=“TENANT_ID”)
)

I am not sure I like the discriminators being within the @Multitenant annotation. It implies that all strategies will have a TennatDiscriminator with the same structure.

The idea was to mimic the inheritance which is configured like:

@Entity
@Table(name="CUST")
@Inheritance(strategy=SINGLE_TABLE)
@DiscriminatorColumn(name="DISC", discriminatorType=STRING,length=20)
@DiscriminatorValue("CUSTOMER")

So, I was thinking we could do something like:

@Entity
@Table(name="EMP")
@Multitenant(strategy=SINGLE_TABLE)
@TenantDiscriminatorColumn(name="COMPANY", discriminatorType=STRING,length=20, property="company-id")

This sets us up for handling multitenancy where each tenant's rows for a given entity arte stored in different tables identified with different names or schema.

@Entity
@Multitenant(strategy=TABLE_PER_TENANT)
@TenantTableDiscriminator(???)

Doug

On 14/03/2011 3:51 PM, Guy Pelletier wrote:
I've gone through another round of updating the multi-tenancy doc.

http://wiki.eclipse.org/EclipseLink/Development/Indigo/Multi-Tenancy

It is still a work in progress, however I think we are getting closer. Please review and provide any feedback.

Thanks,
Guy

_______________________________________________ eclipselink-dev mailing list eclipselink-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-dev
_______________________________________________ eclipselink-dev mailing list eclipselink-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-dev
_______________________________________________
eclipselink-dev mailing list
eclipselink-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev

Back to the top