Powered by SmartDoc

The jdbc.document.columnName option

A jdbc.document.columnName option specifies a configuration for data access.

Parameters

The jdbc.document.columnName option specifies a column name to store a whole document in case of index mapping.

Artifact

The jdbc.document.columnName option generates no additional classes. The jdbc.document.columnName option just modified the behavior of Relaxer table objects.

The jdbc.document.columnName option adds no additional methods to Relaxer objects.

Example

List 12.12.3.1[documentColumnName.rng] is a sample schema for the jdbc.document.columnName option.

documentColumnName.rng
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:sql="http://www.relaxer.org/xmlns/relaxer/sql"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <ref name="account"/>
  </start>
  <define name="account">
    <element name="account">
      <attribute name="accountNo">
        <data type="token"/>
      </attribute>
      <element name="balance">
        <data type="int"/>
      </element>
      <element name="owner">
        <data type="token"/>
      </element>
      <ref name="address"/>
      <zeroOrMore>
        <ref name="phone"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="address">
    <element name="address">
      <attribute name="zip">
        <data type="token"/>
      </attribute>
      <text/>
    </element>
  </define>
  <define name="phone">
    <element name="phone">
      <attribute name="area">
        <data type="token"/>
      </attribute>
      <data type="token"/>
    </element>
  </define>
</grammar>

Execution of Relaxer with the jdbc.document.columnName option is as follows:

$ relaxer -jdbc -jdbc.mapping:index \
    -jdbc.document.columnName:WHOLE documentColumnName.rng

Because the jdbc.document.columnName is available only if the mapping strategy is index, the jdbc.mapping option is used with index as the parameter.

Because the jdbc.document.dolumnName has the parameter 'WHOLE, WHOLE will be a column name of the column of the column that contains whole document.

As a result of the command, Relaxer generates 13 files:

List 12.12.3.2[account.ddl (index mapping)] is the DDL generated by the command. The column name of a last column is WHOLE.

account.ddl (index mapping)
CREATE TABLE "account" (
	"accountNo" VARCHAR(32) NOT NULL,
	"balance" INTEGER NOT NULL,
	"owner" VARCHAR(32) NOT NULL,
	"address" VARCHAR(128) NOT NULL,
	"address_zip" VARCHAR(32) NOT NULL,
	"WHOLE" VARCHAR(8192) NOT NULL
)

In case of direct mapping, this option has no effect to the DDL, as shown in List 12.12.3.3[account.ddl (direct mapping)].

account.ddl (direct mapping)
CREATE TABLE "account" (
	"accountNo" VARCHAR(32) NOT NULL,
	"balance" INTEGER NOT NULL,
	"owner" VARCHAR(32) NOT NULL,
	"address" VARCHAR(128) NOT NULL,
	"address_zip" VARCHAR(32) NOT NULL,
	"phone" VARCHAR(512)
)