<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC

        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"

        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">


<!--



  This mapping demonstrates a mixed inheritance strategy,

  with one subclass acting like a joined-subclass via

  use of a <join>. Also notice the fields which are initialized 

  by an interceptor.

  

-->


<hibernate-mapping

        package="org.hibernate.test.mixed">


    <class name="Item"

           table="Files"

           discriminator-value="I">


        <id name="id">

            <generator class="native"/>

        </id>


        <discriminator type="character"

                       column="itemType"/>


        <property name="name">

            <column name="name"

                    not-null="true"

                    />
            <!--unique-key="folder-parent"-->

        </property>


        <many-to-one name="parent"

                     class="Folder">

            <column name="parentFolderId"

                    />
            <!--unique-key="folder-parent"-->

        </many-to-one>


        <subclass name="Document"

                  discriminator-value="D"

                  lazy="true"

                  dynamic-update="true">


            <property name="content"/>


            <!-- managed by DocumentInterceptor -->

            <property name="modified"/>

            <property name="created"/>


            <subclass name="SecureDocument"

                      discriminator-value="S"

                      dynamic-update="true"

                      lazy="true">


                <join table="SecureDocument">


                    <key column="documentId"/>


                    <property name="permissionBits"

                              not-null="true"/>

                    <property name="owner"

                              not-null="true"/>


                </join>


            </subclass>


        </subclass>


        <subclass name="Folder"

                  discriminator-value="F"/>


    </class>


</hibernate-mapping>