Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Talk:EclipseLink/Development/Indigo/Multi-Tenancy"

(Comments)
(Comments)
Line 7: Line 7:
 
:[[User:James.sutherland.oracle.com|James.sutherland.oracle.com]] 15:08, 2 March 2011 (UTC)
 
:[[User:James.sutherland.oracle.com|James.sutherland.oracle.com]] 15:08, 2 March 2011 (UTC)
 
----
 
----
* The requirement for multiple Tenant Ids is that not all tenants may use the same column or that multiple columns represent the tenant id.  Additional Criteria would not allow for updating those fields.  We may want to change the annotation to indicate that multiple tenant ids is an extension:
+
* The requirement for multiple Tenant Ids is that not all tenants may use the same column or that multiple columns represent the tenant id.  Additional Criteria would not allow for updating those fields.  We may want to change the annotation so that "TenantId" can be used directly and use "TenantShared" as the complex scenario or follow the JPA pattern and use "TenantIds" :
 
<source lang="java">
 
<source lang="java">
@Target({TYPE})
+
@Entity
@Retention(RUNTIME)
+
@Table(name="EMP");
public @interface TenantShared {
+
@TenantId(property="tenant-id")
  /**
+
public class Employee {
  * (Required) At least one tenant id must be specified when using a tenant shared strategy.
+
  */
+
  TenantId value();
+
  TenantId[] additionalIds default {};
+
}
+
 
</source>
 
</source>
  
which gives us:
 
 
<source lang="java">
 
<source lang="java">
@TenantShared( TenantId(property="tenant-id"))
+
@Entity
</source>
+
@Table(name="EMP");
vs
+
@TenantIds(
<source lang="java">
+
    {
@TenantShared(
+
        TenantId(property="tenant-id"),
    {  
+
        TenantId(property="tenant-id2")
        TenantId(property="tenant-id")
+
    }
    }
+
)
)
+
public class Employee {
 
</source>
 
</source>
 +
 
* Each Tenant should be given their own ServerSession.  This should be doable by augmenting the session name or actually updating the code to store the ServerSession by TenantId as well.
 
* Each Tenant should be given their own ServerSession.  This should be doable by augmenting the session name or actually updating the code to store the ServerSession by TenantId as well.
 
:[[User:Gordon.yorke.oracle.com|Gordon Yorke]] 16:15, 3 March 2011 (UTC)
 
:[[User:Gordon.yorke.oracle.com|Gordon Yorke]] 16:15, 3 March 2011 (UTC)

Revision as of 12:24, 3 March 2011

Comments

  • @TenantShared seems much too complicated, why would the user ever require multiple tenant ids in the same Entity?
    • Would be better to support the simple case, and allow the user to use AdditionalCriteria if they have more complex requirements.
  • Also, why have the property specified in TenantId and have the nested Column, why not just have a fixed property name "eclipselink.tenant" and have a TenantColumn similar to DiscriminatorColumn?
  • Will need someway to know the type of the TenantId, similar to the DiscriminatorType, or just maybe have a type which is a Class.
  • Instead of changing every buildRow method to specifically include the tenant column it would be nice to have a more generic mechanism, that can be used for other purposes or more advanced tenant requirements. We could add a special mapping to the descriptor that writes to the column, or have some sort of generic ExtensionPolicy or set of policies on the descriptor that have hooks to support Tenants, SoftDeletes, Auditing, History, etc.
James.sutherland.oracle.com 15:08, 2 March 2011 (UTC)

  • The requirement for multiple Tenant Ids is that not all tenants may use the same column or that multiple columns represent the tenant id. Additional Criteria would not allow for updating those fields. We may want to change the annotation so that "TenantId" can be used directly and use "TenantShared" as the complex scenario or follow the JPA pattern and use "TenantIds" :
@Entity
@Table(name="EMP");
@TenantId(property="tenant-id")
public class Employee {
@Entity
@Table(name="EMP");
@TenantIds(
    {
        TenantId(property="tenant-id"),
        TenantId(property="tenant-id2")
    }
)
public class Employee {
  • Each Tenant should be given their own ServerSession. This should be doable by augmenting the session name or actually updating the code to store the ServerSession by TenantId as well.
Gordon Yorke 16:15, 3 March 2011 (UTC)

Back to the top