<object name="change">
  <layout>
    <xml name="change" nodeType="xs:element"/>
    <sql table="change_tbl"/>
  </layout>
  
  <property name="id" type="long" primaryKey="true">
    <xml nodeType="xs:attribute" type="xs:int"/>
    <sql type="int"/>
  </property>
  
  <property name="what" type="str">
    <xml nodeType="xs:attribute" type="xs:string"/>
    <sql type="varchar(255)"/>
  </property>

  <property name="oldObjId" type="long" foreignKey="true" discriminator="what">
    <xml nodeType="xs:attribute" type="xs:int"/>
    <sql column="old_obj_id" type="int"/>
  </property>

  <property name="newObjId" type="long" foreignKey="true" discriminator="what">
    <xml nodeType="xs:attribute" type="xs:int"/>
    <sql column="new_obj_id" type="int"/>
  </property>

  <property name="parentObjId" type="long" foreignKey="true" 
	    discriminator="parentObjType">
    <xml nodeType="xs:attribute" type="xs:int"/>
    <sql column="par_obj_id" type="int"/>
  </property>

  <property name="parentObjType" type="str">
    <xml nodeType="xs:attribute" type="xs:string"/>
    <sql column="par_obj_type" type="char(16)"/>
  </property>

  <choice name="data" type="object" discriminator="what">
    <property ref="true" object="module" mapping="one-to-one">
      <xml nodeType="xs:element"/>
    </property>
    <property ref="true" object="location" mapping="one-to-one">
      <xml nodeType="xs:element"/>
    </property>
    <property ref="true" object="annotation" mapping="one-to-one">
      <xml nodeType="xs:element"/>
    </property>
    <property ref="true" object="function" mapping="one-to-one">
      <xml nodeType="xs:element"/>
    </property>
    <property ref="true" object="connection" mapping="one-to-one">
      <xml nodeType="xs:element"/>
    </property>
    <property ref="true" object="port" mapping="one-to-one">
      <xml nodeType="xs:element"/>
    </property>
    <property ref="true" object="parameter" mapping="one-to-one">
      <xml nodeType="xs:element"/>
    </property>
    <property ref="true" object="portSpec" mapping="one-to-one">
      <xml nodeType="xs:element"/>
    </property>
    <property ref="true" object="abstractionRef" mapping="one-to-one">
      <xml nodeType="xs:element"/>
    </property>
    <property ref="true" object="group" mapping="one-to-one">
      <xml nodeType="xs:element"/>
    </property>
    <property ref="true" object="other" mapping="one-to-one">
      <xml nodeType="xs:element"/>
    </property>
  </choice>
  
  <property name="action" type="long" ref="true" object="action" 
	    mapping="many-to-one" inverse="true">
    <sql column="action_id" type="int"/>
  </property>

  <property name="entity_id" type="long" inverse="true">
    <sql type="int"/>
  </property>

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

</object>
