Package oracle.jdbc
Interface OracleShardingKey
- All Superinterfaces:
Comparable<OracleShardingKey>,ShardingKey
- All Known Implementing Classes:
OracleShardingKeyImpl
Interface used to indicate that this object represents an Oracle Sharding Key.
A
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 an 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();
- Since:
- 12.2
-
Method Summary
Methods inherited from interface java.lang.Comparable
compareTo