Defining XML datatype column fields in the Java metadata class

To use IMS Universal JDBC driver support for XML, you need to define the XML datatype column fields for storing and retrieving XML data.

Note: 15 and later supports new DBD generation parameters for XML datatype definitions: the DATATYPE=XML parameter for the FIELD statement and the OVERFLOW segment definition for the DFSMARSH statement. If you use these parameters, the Java™ metadata class will already contain the XML definitions and you do not need to modify the class. If you are using the IMS catalog database, the metadata is available with a data connection instead of with a static metadata class.
To define an XML data type column field in the Java metadata class:

Procedure

  1. Generate the Java metadata class with the IMS Enterprise Suite Explorer for Development.
  2. Generate the XML schema for the database with the IMS Enterprise Suite DLIModel utility plug-in or manually create the XML schema based on the DBD and data type mappings.
  3. Specify the XML datatype column field by modifying the generated Java metadata class.
    If you are storing or retrieving XML data in decomposed storage mode, define the XML datatype column field with the following DLITypeInfo constructor syntax. One or more XML datatype column fields can be defined in a segment.
    public DLITypeInfo(String fieldName, 
    			         String XMLSchemaName,
     			         DLITypeInfo.XML);
  4. During database connection setup, pass the name of the Java metadata class to the IMS Universal JDBC driver.
The following example shows how to define XML column datatype fields in a Java metadata class for decomposed mode. In this example, an XML datatype column field named HOSPXML is defined that is associated with the BMP255-PCB01.xsd XML schema. Another XML datatype column field named HXML is defined that is associated with the B.xsd XML schema.
// The following describes Segment: HOSPITAL ("HOSPITAL") in PCB: PCB01 ("PCB01")
    static DLITypeInfo[] PCB01HOSPITALArray= {
        new DLITypeInfo("HOSPLL", DLITypeInfo.CHAR, 1, 2, "HOSPLL"),
        new DLITypeInfo("HOSPCODE", DLITypeInfo.CHAR, 3, 12, 
           "HOSPCODE", DLITypeInfo.UNIQUE_KEY),       
        new DLITypeInfo("HOSPNAME", DLITypeInfo.CHAR, 15, 17, "HOSPNAME"),
        new DLITypeInfo("HOSPXML", "BMP255-PCB01.xsd", DLITypeInfo.XML),
        new DLITypeInfo("HXML", "B.xsd", DLITypeInfo.XML)
    };