GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Overview
  • Use
  • Tree
  • Preview
  • New
  • Deprecated
  • Index
  • Search
  • Help
  • java.sql
  • java.sql
  • ShardingKey

This view

  • Original page
  • New address

GeezerVison is showing docs.oracle.com — ShardingKey (Java SE 24 & JDK 24)

Interface ShardingKey


public interface ShardingKey
Interface used to indicate that this object represents a Sharding Key. A ShardingKey instance is only guaranteed to be compatible with the data source instance that it was derived from. A ShardingKey is created using ShardingKeyBuilder.

The following example illustrates the use of ShardingKeyBuilder to create a ShardingKey:

 

     DataSource ds = new MyDataSource();
     ShardingKey shardingKey = ds.createShardingKeyBuilder()
                           .subkey("abc", JDBCType.VARCHAR)
                           .subkey(94002, JDBCType.INTEGER)
                           .build();
 
 

A ShardingKey may also be used for specifying a superShardingKey. Databases that support composite Sharding may use a superShardingKey to specify a additional level of partitioning within the Shard.

The following example illustrates the use of ShardingKeyBuilder to create a superShardingKey for an eastern region with a ShardingKey specified for the Pittsburgh branch office:

 

     DataSource ds = new MyDataSource();
     ShardingKey superShardingKey = ds.createShardingKeyBuilder()
                           .subkey("EASTERN_REGION", JDBCType.VARCHAR)
                           .build();
     ShardingKey shardingKey = ds.createShardingKeyBuilder()
                           .subkey("PITTSBURGH_BRANCH", JDBCType.VARCHAR)
                           .build();
     Connection con = ds.createConnectionBuilder()
                           .superShardingKey(superShardingKey)
                           .shardingKey(shardingKey)
                           .build();
 
 

Since:
9
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.