Powered by SmartDoc

The jdbc.fragment.type option

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

Parameters

The jdbc.fragment.type option specifies a column name to store a whole fragment when using index mapping.

Artifact

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

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

Example

List 12.15.3.1[fragmentType.rng] is a sample schema for the jdbc.fragment.type option.

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

$ relaxer -jdbc -jdbc.mapping:index -jdbc.fragment.type:TEXT \
    fragmentType.rng

As a result, Relaxer generates 13 files:

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

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" TEXT
)

With index mapping, this option has no effect to the DDL as shown in List 12.15.3.3[account.ddl (index mapping)].

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" VARCHAR(8192) NOT NULL
)