<?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.ontology.SimpleComparableTriple" table="term_relationship" node="triple" entity-name="Triple">

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

        <many-to-one name="subject" class="Term" column="subject_term_id" not-null="true" cascade="persist,merge,save-update" node="@subjectTermId" embed-xml="false"/>
        <many-to-one name="object" class="Term" column="object_term_id" not-null="true" cascade="persist,merge,save-update" node="@objectTermId" embed-xml="false"/>
        <many-to-one name="predicate" class="Term" column="predicate_term_id" not-null="true" cascade="persist,merge,save-update" node="@predicateTermId" embed-xml="false"/>
        <many-to-one name="ontology" class="Ontology" column="ontology_id" not-null="true" cascade="persist,merge,save-update" node="@ontologyId" embed-xml="false"/>
        <set name="descriptors" table="term_relationship_term" lazy="false" cascade="all" sort="natural">
            <key column="term_relationship_id" not-null="true"/>
            <many-to-many class="Term" column="term_id" node="descriptorTermId" embed-xml="false"/>
        </set>
    </class>

</hibernate-mapping>
