author | iris |
Wed, 20 Jan 2016 11:02:36 -0800 | |
changeset 35302 | e4d2275861c3 |
parent 34338 | 67d0e5867568 |
permissions | -rw-r--r-- |
34338 | 1 |
/* |
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
package java.sql; |
|
26 |
||
27 |
/** |
|
28 |
* Interface used to indicate that this object represents a Sharding Key. A |
|
29 |
* {@code ShardingKey} instance is only guaranteed to be compatible with the |
|
30 |
* data source instance that it was derived from. A {@code ShardingKey} is |
|
31 |
* created using {@link ShardingKeyBuilder}. |
|
32 |
* <p> |
|
33 |
* The following example illustrates the use of {@link ShardingKeyBuilder} to |
|
34 |
* create a {@code ShardingKey}: |
|
35 |
* <pre> |
|
36 |
* {@code |
|
37 |
* |
|
38 |
* DataSource ds = new MyDataSource(); |
|
39 |
* ShardingKey shardingKey = ds.createShardingKeyBuilder() |
|
40 |
* .subkey("abc", JDBCType.VARCHAR) |
|
41 |
* .subkey(94002, JDBCType.INTEGER) |
|
42 |
* .build(); |
|
43 |
* } |
|
44 |
* </pre> |
|
45 |
* <p> |
|
46 |
* |
|
47 |
* A {@code ShardingKey} may also be used for specifying a |
|
48 |
* {@code superShardingKey}. Databases that support composite Sharding may use a |
|
49 |
* {@code superShardingKey} to specify a additional level of partitioning within |
|
50 |
* the Shard. |
|
51 |
* <p> |
|
52 |
* The following example illustrates the use of {@link ShardingKeyBuilder} to |
|
53 |
* create a {@code superShardingKey} for an eastern region with a |
|
54 |
* {@code ShardingKey} specified for the Pittsburgh branch office: |
|
55 |
* <pre> |
|
56 |
* {@code |
|
57 |
* |
|
58 |
* DataSource ds = new MyDataSource(); |
|
59 |
* ShardingKey superShardingKey = ds.createShardingKeyBuilder() |
|
60 |
* .subkey("EASTERN_REGION", JDBCType.VARCHAR) |
|
61 |
* .build(); |
|
62 |
* ShardingKey shardingKey = ds.createShardingKeyBuilder() |
|
63 |
* .subkey("PITTSBURGH_BRANCH", JDBCType.VARCHAR) |
|
64 |
* .build(); |
|
65 |
* Connection con = ds.createConnectionBuilder() |
|
66 |
* .superShardingKey(superShardingKey) |
|
67 |
* .shardingKey(shardingKey) |
|
68 |
* .build(); |
|
69 |
* } |
|
70 |
* </pre> |
|
71 |
* |
|
35302
e4d2275861c3
8136494: Update "@since 1.9" to "@since 9" to match java.version.specification
iris
parents:
34338
diff
changeset
|
72 |
* @since 9 |
34338 | 73 |
*/ |
74 |
public interface ShardingKey { |
|
75 |
||
76 |
} |