Generate DDL

Top  Previous  Next

Generating the ddl for a container that does not yet have an associated database table is as simple as:

 

define an identity on the container

 

Then simply add the -ddl tag when using the CodeGenerator to process the schema:

 

    CodeGenerator.exe -schema ../qti.xml -outputFolder ../out -ddl

 

 

<schema packageScope="com.wickedfastsolutions.domain" targetNamespace="http://www.imsglobal.org/xsd/imsqti_metadata_v2p1">
    <qtiMetadata>
        <itemTemplate maxLength="5" minLength="4" minOccurs="0" regex="true|false" truthValues="true" type="boolean">true</itemTemplate>
        <timeDependent maxLength="5" minLength="4" minOccurs="0" regex="true|false" truthValues="true" type="boolean">true</timeDependent>
        <composite maxLength="5" minLength="4" minOccurs="0" regex="true|false" truthValues="true" type="boolean">true</composite>
        <interactionType maxOccurs="unbounded" minOccurs="0" regex="associateInteraction|choiceInteraction|customInteraction|drawingInteraction|endAttemptInteraction|extendedTextInteraction|gapMatchInteraction|graphicAssociateInteraction|graphicGapMatchInteraction|graphicOrderInteraction|hotspotInteraction|hottextInteraction|inlineChoiceInteraction|matchInteraction|orderInteraction|positionObjectInteraction|selectionPointInteraction|sliderInteraction|textEntryInteraction|uploadInteraction">associateInteraction</interactionType>
        <feedbackType minOccurs="0" regex="adaptive|nonadaptive|none">adaptive</feedbackType>
        <solutionAvailable maxLength="5" minLength="4" minOccurs="0" regex="true|false" truthValues="true" type="boolean">true</solutionAvailable>
        <toolName maxLength="256" minOccurs="0"></toolName>
        <toolVersion maxLength="256" minOccurs="0"></toolVersion>
        <toolVendor maxLength="256" minOccurs="0"></toolVendor>
    </qtiMetadata>
</schema>

 

becomes

 

<schema packageScope="com.wickedfastsolutions.domain" targetNamespace="http://www.imsglobal.org/xsd/imsqti_metadata_v2p1">
    <qtiMetadata identity="id">
        <id type="integer" autoIncremented="true">1</id>
        <itemTemplate maxLength="5" minLength="4" minOccurs="0" regex="true|false" truthValues="true" type="boolean">true</itemTemplate>
        <timeDependent maxLength="5" minLength="4" minOccurs="0" regex="true|false" truthValues="true" type="boolean">true</timeDependent>
        <composite maxLength="5" minLength="4" minOccurs="0" regex="true|false" truthValues="true" type="boolean">true</composite>
        <interactionType maxOccurs="unbounded" minOccurs="0" regex="associateInteraction|choiceInteraction|customInteraction|drawingInteraction|endAttemptInteraction|extendedTextInteraction|gapMatchInteraction|graphicAssociateInteraction|graphicGapMatchInteraction|graphicOrderInteraction|hotspotInteraction|hottextInteraction|inlineChoiceInteraction|matchInteraction|orderInteraction|positionObjectInteraction|selectionPointInteraction|sliderInteraction|textEntryInteraction|uploadInteraction">associateInteraction</interactionType>
        <feedbackType minOccurs="0" regex="adaptive|nonadaptive|none">adaptive</feedbackType>
        <solutionAvailable maxLength="5" minLength="4" minOccurs="0" regex="true|false" truthValues="true" type="boolean">true</solutionAvailable>
        <toolName maxLength="256" minOccurs="0"></toolName>
        <toolVersion maxLength="256" minOccurs="0"></toolVersion>
        <toolVendor maxLength="256" minOccurs="0"></toolVendor>
    </qtiMetadata>
</schema>
 

and then to generate the entity manager (which allows you to store it in the database) add a catalog and dataSourceName

 

 

<schema catalog="MyDatabase" dataSourceName="jdbc/MyDatabase" packageScope="com.wickedfastsolutions.domain" targetNamespace="http://www.imsglobal.org/xsd/imsqti_metadata_v2p1">
    <qtiMetadata identity="id">
        <id type="integer" autoIncremented="true">1</id>
        <itemTemplate maxLength="5" minLength="4" minOccurs="0" regex="true|false" truthValues="true" type="boolean">true</itemTemplate>
        <timeDependent maxLength="5" minLength="4" minOccurs="0" regex="true|false" truthValues="true" type="boolean">true</timeDependent>
        <composite maxLength="5" minLength="4" minOccurs="0" regex="true|false" truthValues="true" type="boolean">true</composite>
        <interactionType maxOccurs="unbounded" minOccurs="0" regex="associateInteraction|choiceInteraction|customInteraction|drawingInteraction|endAttemptInteraction|extendedTextInteraction|gapMatchInteraction|graphicAssociateInteraction|graphicGapMatchInteraction|graphicOrderInteraction|hotspotInteraction|hottextInteraction|inlineChoiceInteraction|matchInteraction|orderInteraction|positionObjectInteraction|selectionPointInteraction|sliderInteraction|textEntryInteraction|uploadInteraction">associateInteraction</interactionType>
        <feedbackType minOccurs="0" regex="adaptive|nonadaptive|none">adaptive</feedbackType>
        <solutionAvailable maxLength="5" minLength="4" minOccurs="0" regex="true|false" truthValues="true" type="boolean">true</solutionAvailable>
        <toolName maxLength="256" minOccurs="0"></toolName>
        <toolVersion maxLength="256" minOccurs="0"></toolVersion>
        <toolVendor maxLength="256" minOccurs="0"></toolVendor>
    </qtiMetadata>
</schema>