Comparable<OracleShardingKey>
, ShardingKey
OracleShardingKeyImpl
public interface OracleShardingKey extends Comparable<OracleShardingKey>, ShardingKey
OracleShardingKey
instance is only guaranteed to be compatible with the oracle data source instance that it was derived from. A OracleShardingKey
is created using OracleShardingKeyBuilder
.
The following example illustrates the use of OracleShardingKeyBuilder
to create a OracleShardingKey
:
OracleDataSource ods = new oracle.jdbc.pool.OracleDataSource();
OracleShardingKey shardingKey =
ods.createShardingKeyBuilder()
.subkey("Customer_Name_XYZ", JDBCType.VARCHAR)
.subkey(94002, JDBCType.NUMERIC)
.build();
A OracleShardingKey
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 OracleShardingKeyBuilder
to create a superShardingKey
for an eastern region with a OracleShardingKey
specified for the Pittsburgh branch office:
OracleDataSource ods = new oracle.pool.OracleDataSource();
OracleShardingKey superShardingKey =
ods.createShardingKeyBuilder()
.subkey("EASTERN_REGION", JDBCType.VARCHAR)
.build();
OracleShardingKey shardingKey =
ods.createShardingKeyBuilder()
.subkey("PITTSBURGH_BRANCH", JDBCType.VARCHAR)
.build();
OracleConnection conn = ods.createConnectionBuilder()
.superShardingKey(superShardingKey)
.shardingKey(shardingKey)
.build();
compareTo