<?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.SimpleComparableTerm" table="term" node="term" entity-name="Term">

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

        <property name="name" node="@name"/>
        <property name="identifier"/>
        <property name="description" column="definition"/>
        <property name="obsoleteChar" column="is_obsolete" node="@obsolete"/>
        <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="synonymSet" table="term_synonym" lazy="false" sort="natural">
            <key column="term_id"/>
            <element type="string" column="synonym" node="synonym"/>
        </set>
        <set name="rankedCrossRefs" table="term_dbxref" lazy="false" sort="natural">
            <key column="term_id"/>
            <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>
        
    </class>

</hibernate-mapping>