Module eclipselink

Annotation Interface TenantDiscriminatorColumn


@Target(TYPE) @Retention(RUNTIME) @Repeatable(TenantDiscriminatorColumns.class) public @interface TenantDiscriminatorColumn
Tenant discriminator column(s) are used with a MultitenantType.SINGLE_TABLE multitenant strategy. Tenant discriminator column(s) are completely user specified and there is no limit on how many tenant discriminator columns an application can define (ie using the TenantDiscriminatorColumns annotation)

Tenant discriminator column(s) can be specified at the Entity or MappedSuperclass level and must always be accompanied by a @Multitenant(SINGLE_TABLE) specification. It is not sufficient to specify only tenant discriminator column(s).

See Also:
Author:
Guy Pelletier
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The SQL fragment that is used when generating the DDL for the discriminator column.
    The name of the context property to apply to the tenant discriminator column.
    jakarta.persistence.DiscriminatorType
    The type of object/column to use as a class discriminator.
    int
    The column length for String-based discriminator types.
    The name of column to be used for the tenant discriminator.
    boolean
    Specifies that the tenant discriminator column is part of the primary key of the tables.
    The name of the table that contains the column.
  • Element Details

    • name

      String name
      The name of column to be used for the tenant discriminator.
      Default:
      "TENANT_ID"
    • contextProperty

      String contextProperty
      The name of the context property to apply to the tenant discriminator column.
      Default:
      "eclipselink.tenant-id"
    • discriminatorType

      jakarta.persistence.DiscriminatorType discriminatorType
      The type of object/column to use as a class discriminator.

      Defaults to DiscriminatorType.STRING.

      Default:
      STRING
    • columnDefinition

      String columnDefinition
      The SQL fragment that is used when generating the DDL for the discriminator column.

      Defaults to the provider-generated SQL to create a column of the specified discriminator type.

      Default:
      ""
    • length

      int length
      The column length for String-based discriminator types. Ignored for other discriminator types.
      Default:
      31
    • table

      String table
      The name of the table that contains the column.

      If absent the column is assumed to be in the primary table.

      Default:
      ""
    • primaryKey

      boolean primaryKey
      Specifies that the tenant discriminator column is part of the primary key of the tables.
      Default:
      false