Powered by SmartDoc

The jdbc.document.type option

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

Parameters

The jdbc.document.type option specifies a column name to store a whole document in case index mapping is used.

Artifact

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

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

Example

List 12.13.3.1[documentType.rng] is a sample schema for the jdbc.document.type option.

documentType.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.type option is as follows:

$ relaxer -jdbc -jdbc.mapping:index -jdbc.document.type:TEXT \
    documentType.rng

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

Because the jdbc.document.type uses the parameter TEXT in this command, the length of the data for the column which contains whole document will be 10000.

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

List 12.13.3.2[account.ddl (index mapping)] is the DDL generated by this command. The data length of the column which contain a document fragment is TEXT.

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,
	"document" TEXT NOT NULL
)

In case of direct mapping, this option has no effect on the DDL as shown in List 12.13.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)
)