<object name="module">
  <layout>
    <xml name="module" nodeType="xs:element"/>
    <sql table="module"/>
  </layout>

  <property name="id" type="long" primaryKey="true">
    <xml nodeType="xs:attribute" type="xs:int"/>
    <sql type="int"/>
  </property>

  <property name="cache" type="int">
    <xml nodeType="xs:attribute" type="xs:int"/>
    <sql type="int"/>
  </property>

  <property name="name" type="str">
    <xml nodeType="xs:attribute" type="xs:string"/>
    <sql type="varchar(255)"/>
  </property>

  <property name="package" type="str">
    <xml nodeType="xs:attribute" type="xs:string"/>
    <sql type="varchar(511)"/>
  </property>
  
  <property name="version" type="str">
    <xml nodeType="xs:attribute" type="xs:string"/>
    <sql type="varchar(255)"/>
  </property>

  <property ref="true" object="location" type="object" mapping="one-to-one">
    <xml nodeType="xs:element"/>
  </property>

  <property ref="true" object="function" type="list" mapping="one-to-many">
    <xml nodeType="xs:element"/>
  </property>

  <property ref="true" object="annotation" type="hash" mapping="one-to-many"
	    index="key">
    <xml nodeType="xs:element"/>
  </property>

  <property ref="true" object="portSpec" type="hash" mapping="one-to-many"
	    index="name">
    <xml nodeType="xs:element"/>
  </property>

  <property name="parentType" type="str" inverse="true">
    <sql column="parent_type" type="char(16)"/>
  </property>

  <choice name="parent" type="long" discriminator="parentType" inverse="true" 
	  mapping="many-to-one">
    <property ref="true" object="workflow">
      <sql column="parent_id" type="int"/>
    </property>
    <property ref="true" object="add">
      <sql column="parent_id" type="int"/>
    </property>
    <property ref="true" object="change">
      <sql column="parent_id" type="int"/>
    </property>
  </choice>

  <property name="vistrailId" type="long" inverse="true"
	    foreignKey="true" object="vistrail">
    <sql column="vt_id" type="int"/>
  </property>

</object>
