<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>

    <class name="org.biojavax.bio.seq.SimpleRichFeature" table="seqfeature" node="feature" entity-name="Feature">

        <id name="id" type="integer" unsaved-value="null" column="seqfeature_id" node="@id">
            <generator class="native"/>
        </id>

        <many-to-one name="parent" class="ThinSequence" column="bioentry_id" not-null="true" cascade="persist,merge,save-update" node="@parentRichSequenceId" embed-xml="false"/>
        <many-to-one name="sourceTerm" class="Term" column="source_term_id" not-null="true" cascade="persist,merge,save-update" node="@sourceTermId" embed-xml="false"/>
        <many-to-one name="typeTerm" class="Term" column="type_term_id" not-null="true" cascade="persist,merge,save-update" node="@typeTermId" embed-xml="false"/>
        <property name="name" column="display_name" node="@name"/>
        <property name="rank" node="@rank"/>
        <set name="locationSet" lazy="false" cascade="all-delete-orphan" sort="natural" inverse="true">
            <key column="seqfeature_id"/>
            <one-to-many class="Location" embed-xml="true"/>
        </set>
        <set name="noteSet" table="seqfeature_qualifier_value" lazy="false" sort="natural">
            <key column="seqfeature_id" not-null="true"/>
            <composite-element class="org.biojavax.SimpleNote" node="note">
                <many-to-one name="term" class="Term" column="term_id" not-null="true" cascade="persist,merge,save-update" node="@termId" embed-xml="false"/>
                <property name="value", type="text"/>
                <property name="rank" node="@rank"/>
            </composite-element>
        </set>  
        <set name="rankedCrossRefs" table="seqfeature_dbxref" lazy="false" sort="natural">
            <key column="seqfeature_id" not-null="true"/>
            <composite-element class="org.biojavax.SimpleRankedCrossRef" node="rankedCrossRef">
                <many-to-one name="crossRef" class="CrossRef" column="dbxref_id" not-null="true" cascade="persist,merge,save-update" node="@crossRefId" embed-xml="false"/>
                <property name="rank" node="@rank"/>
            </composite-element>
        </set>
        <set name="featureRelationshipSet" lazy="false" cascade="all-delete-orphan" sort="natural" inverse="true">
            <key column="object_seqfeature_id"/>
            <one-to-many class="FeatureRelationship" embed-xml="true"/>
        </set>
        
    </class>

</hibernate-mapping>
