<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "classpath://org/hibernate/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="storybook.model.hbn.entity">
    <class name="Relationship" table="RELATIONSHIP">
        <id column="ID" name="id" type="java.lang.Long" unsaved-value="null">
            <generator
                class="increment">
            </generator>
        </id>
        <!-- common data -->
        <property column="creation" name="creation" type="java.lang.String" insert="true" update="true" />
        <property column="maj"      name="maj"      type="java.lang.String" insert="true" update="true" />
        <property column="name"     name="name"     type="java.lang.String" insert="true" update="true" length="256" />
        <property column="description" name="description" type="java.lang.String" insert="true" update="true" length="32768" />
        <property column="notes"    name="notes" type="java.lang.String" insert="true" update="true" length="32768" />
        <property column="assistant" name="assistant" type="java.lang.String" insert="true" update="true" length="32768" />
        <!-- specific data -->
        <many-to-one
            column="person1_id" name="person1" class="storybook.model.hbn.entity.Person"
            cascade="none" lazy="false" outer-join="auto" insert="true" update="true" />
        <many-to-one
            column="person2_id" name="person2" class="storybook.model.hbn.entity.Person"
            cascade="none" lazy="false" outer-join="auto" insert="true" update="true" />
        <many-to-one
            column="start_scene_id" name="startScene" class="storybook.model.hbn.entity.Scene"
            cascade="none" lazy="false" outer-join="auto" insert="true" update="true" />
        <many-to-one
            column="end_scene_id" name="endScene" class="storybook.model.hbn.entity.Scene"
            cascade="none" lazy="false" outer-join="auto" insert="true" update="true" />
        <bag
            name="persons" table="relationship_persons"
            cascade="none" lazy="false" >
            <key column="relationship_id"></key>
            <many-to-many
                column="person_id" class="storybook.model.hbn.entity.Person" outer-join="auto"/>
        </bag>
        <bag
            name="locations" table="relationship_locations"
            cascade="none" lazy="false">
            <key column="relationship_id"></key>
            <many-to-many
                column="location_id" class="storybook.model.hbn.entity.Location" outer-join="auto"/>
        </bag>
        <bag
            name="items" table="relationship_items"
            cascade="none" lazy="false">
            <key column="relationship_id"></key>
            <many-to-many
                column="item_id" class="storybook.model.hbn.entity.Item" outer-join="auto"/>
        </bag>
    </class>
</hibernate-mapping>
