<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN" 
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping
>
    <class
        name="test.hibernate.Product"
        table="PRODUCTS"
        dynamic-update="true"
        discriminator-value="null"
    >

        <jcs-cache usage="read-only" />

        <id
            name="id"
            column="id"
            type="java.lang.Long"
            unsaved-value="null"
        >
            <generator class="sequence">
                <param name="table">HIVAL</param>
                <param name="column">NEXT</param>
              <!--  
                  To add non XDoclet generator parameters, create a file named 
                  hibernate-generator-params-Product.xml 
                  containing the additional parameters and place it in your merge dir. 
              --> 
            </generator>
        </id>

        <discriminator
            column="PRODUCT_TYPE"
            not-null="false"
            type="string"
            length="16"
        />

        <version
            name="version"
            column="version"
            type="int"
        />

        <property
            name="description"
            type="java.lang.String"
            update="true"
            insert="true"
            column="description"
            length="512"
        />

        <property
            name="code"
            type="java.lang.String"
            update="false"
            insert="true"
            column="code"
            length="16"
            unique="true"
        />

        <property
            name="image"
            type="byte[]"
            update="true"
            insert="true"
            column="image"
            length="4096"
        />

        <property
            name="price"
            type="java.math.BigDecimal"
            update="true"
            insert="true"
            column="price"
        />

        <property
            name="updateComment"
            type="java.lang.String"
            update="true"
            insert="true"
            column="LAST_UPDATED_BY"
        />

        <property
            name="created"
            type="timestamp"
            update="false"
            insert="true"
            column="created"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Product.xml
            containing the additional properties and place it in your merge dir.
        -->
        <subclass
            name="test.hibernate.Pet"
            discriminator-value="pet"
        >

        <one-to-one
            name="animal"
            class="test.hibernate.Animal"
            cascade="none"
            outer-join="auto"
            constrained="false"
        />

	    <!--
            	To add non XDoclet property mappings, create a file named
                hibernate-properties-Pet.xml
		containing the additional properties and place it in your merge dir.
	    -->

        </subclass>
        <subclass
            name="test.hibernate.ImportedProduct"
            dynamic-update="true"
            dynamic-insert="true"
            select-before-update="false"
            discriminator-value="imported"
        >
        <property
            name="origin"
            type="java.lang.String"
            update="true"
            insert="true"
            column="origin"
            not-null="true"
        />

        <property
            name="locale"
            type="java.util.Locale"
            update="true"
            insert="true"
            column="locale"
        />

	    <!--
            	To add non XDoclet property mappings, create a file named
                hibernate-properties-ImportedProduct.xml
		containing the additional properties and place it in your merge dir.
	    -->
        <subclass
            name="test.hibernate.Contraband"
            discriminator-value="contraband"
        >
	    <!--
            	To add non XDoclet property mappings, create a file named
                hibernate-properties-Contraband.xml
		containing the additional properties and place it in your merge dir.
	    -->

        </subclass>

        </subclass>

    </class>

</hibernate-mapping>
