create
create gpdb-mapping
Specify the mapping between a GPDB table and a GemFire region.
Availability: Online. You must be connected in gfsh
to a JMX Manager member to use this command.
Syntax:
create gpdb-mapping --data-source=value --pdx-name=value --region=value
--table=value [--id=value]
Parameters, create gpdb-mapping:
Name | Description |
---|---|
‑‑region | Required. Name of the GemFire region to associate with the GPDB table. |
‑‑data-source | Required. The name of the JNDI data source to use for the GPDB JDBC connection. |
‑‑pdx-name | Required. Path and class name of the PDX serializer implementation, or a name that will be used for the default implementation. |
‑‑table | Required. The GPDB table name to associate with the GemFire region. May be prefixed with the schema name. |
‑‑id | Name of the PDX field to use as the key in the identification of a GemFire entry. For composite keys, specify multiple names within a comma-separated list. If not specified, the primary key from the GPDB table is used. If there is no primary key, an error message is issued. |
Sample Output:
gfsh>create gpdb-mapping --data-source=datasource --pdx-name=Child \
--region=/Child --table=Child --id=id
Member | Status | Message
------- | ------ | -------
server1 | OK | SUCCESS
Created mapping for region Child to GPDB table Child
Changes to configuration for group 'cluster' is persisted.
gfsh>create gpdb-mapping --region=/Child --data-source=datasource \
--pdx-name="io.pivotal.gemfire.demo.entity.Child" --table=child --id=id,parent_id
Member | Status | Message
------- | ------ | -------
server1 | OK | SUCCESS
server2 | OK | SUCCESS
Changes to configuration for group 'cluster' are persisted.
This example shows the error message that results from
not specifying the --id
option for the case in which the GPDB table
does not have a primary key:
gfsh>create gpdb-mapping --region=/Parent --data-source=datasource \
--pdx-name="io.pivotal.gemfire.demo.entity.Parent" --table=Parent
Member | Status | Message
------- | ------ | -------------------------------------------------------------
server1 | ERROR | Table Parent lacks a primary key. Please use the --id option.
server2 | ERROR | Table Parent lacks a primary key. Please use the --id option.