Annotation Interface Sharded


@Documented @Retention(RUNTIME) @Target(TYPE) public @interface Sharded
Generates the table of an entity as an Oracle sharded table, partitioned across the shards of an Oracle Globally Distributed Database by consistent hash of its sharding key (CREATE SHARDED TABLE ... PARTITION BY CONSISTENT HASH ... PARTITIONS AUTO).

The sharding key must be part of the primary key and be assigned by the application, which needs it to connect to the shard before the insert, so the key cannot use GeneratedValue. Oracle does not allow identity columns in sharded tables, and an entity with a join table cannot be sharded. Indexes are generated as local indexes, and a unique index must contain the sharding key. A table with a parent() belongs to the table family of the parent and is stored in the same shard as the parent rows with the same sharding key (PARENT). Other dialects generate a plain table.

Since:
5.3
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
     
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
     
     
  • Element Details

    • key

      String[] key
      Returns:
      The properties of the sharding key, with dots for the properties of an embedded id, for example id.customerId. Defaults to the primary key, or to the sharding key of the parent()
      Default:
      {}
    • parent

      Class<?> parent
      Returns:
      The root entity of the table family, if this table is a child table of the family
      Default:
      void.class
    • tablespaceSet

      String tablespaceSet
      Returns:
      The tablespace set that stores the partitions (TABLESPACE SET). Oracle has no default tablespace set for sharded tables