Powered by SmartDoc

transient

The extention syntax transient attribute specifies a target column that is transient.

Target

ACCOUNT_NOThe target of the transient attribute is to label ACCOUNT_NOa column as transient.

Parameters

The transient attribute takes one of the following values as a parameter:

true
The value of property is transient.
false
The value of property is persistent.

Artifact

If true, the target property does not map a column in the DDL.

Example

List 13.8.4.1[transient.rng] is a sample schema for the transient attribute.

transient.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" sql:transient="true">
        <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>

In the schema, the extension attribute sql:transient is specified in the element named "accountNo". This definition means that this column is transient.

Execution of Relaxer with the transient attribute is as follows. No special options are required.

$ relaxer -jdbc transient.rng

As a result, Relaxer generates 13 files:

The file account.ddl, in List 13.8.4.2[account.ddl], shows the effect of the transient attribute.

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

INSERT

INSERT INTO "tableName"
 ("balance",
  "owner",
  "address",
  "address_zip",
  "phone") VALUES (?, ?, ?, ?, ?)