Start line:  
End line:  

Snippet Preview

Snippet HTML Code

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

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

<hibernate-mapping
>
    <class
        name="net.smartlab.web.registry.Entry"
        table="`entry`"
        schema="registry"
    >

        <id
            name="id"
            column="`id`"
            type="long"
            unsaved-value="0"
        >
            <generator class="native">
              <!--  
                  To add non XDoclet generator parameters, create a file named 
                  hibernate-generator-params-Entry.xml 
                  containing the additional parameters and place it in your merge dir. 
              --> 
            </generator>
        </id>

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

        <property
            name="display"
            type="java.lang.String"
            update="true"
            insert="true"
            column="`display`"
            length="50"
            not-null="true"
        />

        <map
            name="properties"
            table="`property`"
            schema="registry"
            lazy="true"
            sort="unsorted"
            inverse="false"
            cascade="all"
        >

            <key
                column="`entry`"
            >
            </key>

            <index
                column="`name`"
                type="java.lang.String"
                length="50"
            />

            <element
                column="`value`"
                type="java.lang.String"
                length="255"
                not-null="false"
                unique="false"
            />

        </map>

        <set
            name="lists"
            table="`list_entry`"
            schema="registry"
            lazy="true"
            inverse="true"
            cascade="none"
            sort="natural"
        >

            <key
                column="`entry`"
            >
            </key>

            <many-to-many
                class="net.smartlab.web.registry.List"
                column="`list`"
                outer-join="auto"
             />

        </set>

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

        <joined-subclass
            name="net.smartlab.web.registry.List"
            table="`list`"
            schema="registry"
        >
            <key
                column="`id`"
            />
        <property
            name="description"
            type="text"
            update="true"
            insert="true"
            column="description"
        />

        <set
            name="entries"
            table="`list_entry`"
            schema="registry"
            lazy="true"
            cascade="none"
            sort="natural"
        >

            <key
                column="`list`"
            >
            </key>

            <many-to-many
                class="net.smartlab.web.registry.Entry"
                column="`entry`"
                outer-join="auto"
             />

        </set>

        <property
            name="size"
            type="int"
            formula="(select count(*) from registry.list_entry where registry.list_entry.list=id )"
            update="false"
            insert="false"
        />

        </joined-subclass>
        <joined-subclass
            name="net.smartlab.web.registry.Entity"
            table="`entity`"
            schema="registry"
        >
            <key
                column="`id`"
            />

        <set
            name="addresses"
            lazy="true"
            cascade="all"
            sort="unsorted"
            order-by="`priority` desc"
        >

            <key
                column="`entity`"
            >
            </key>

            <one-to-many
                  class="net.smartlab.web.registry.Address"
            />

        </set>

        <set
            name="relationships"
            table="`relationship`"
            schema="registry"
            lazy="true"
            cascade="all"
            sort="unsorted"
        >

            <key
                column="`source`"
            >
            </key>

            <composite-element
                class="net.smartlab.web.registry.Relationship"
            >
        <property
            name="name"
            type="java.lang.String"
            update="true"
            insert="true"
            column="`name`"
            length="250"
            not-null="true"
        />

        <many-to-one
            name="target"
            class="net.smartlab.web.registry.Entity"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
            column="`target`"
            not-null="true"
        />

            </composite-element>

        </set>

        <joined-subclass
            name="net.smartlab.web.registry.Person"
            table="`person`"
            schema="registry"
        >
            <key
                column="`id`"
            />

        <component
            name="name"
            class="net.smartlab.web.registry.Name"
        >
        <property
            name="firstname"
            type="java.lang.String"
            update="true"
            insert="true"
            column="`firstname`"
            length="250"
        />

        <property
            name="lastname"
            type="java.lang.String"
            update="true"
            insert="true"
            column="`lastname`"
            length="250"
        />

        <property
            name="middlename"
            type="java.lang.String"
            update="true"
            insert="true"
            column="`middlename`"
            length="250"
        />

        <property
            name="title"
            type="java.lang.String"
            update="true"
            insert="true"
            column="`title`"
            length="250"
        />

        </component>

        <property
            name="gender"
            type="net.smartlab.web.registry.Person$Gender"
            update="true"
            insert="true"
            column="`gender`"
        />

        <property
            name="birthdate"
            type="java.sql.Date"
            update="true"
            insert="true"
            column="`birthdate`"
        />

        <component
            name="birthplace"
            class="net.smartlab.web.registry.Locality"
        >
        <property
            name="city"
            type="java.lang.String"
            update="true"
            insert="true"
            column="`city`"
            length="100"
        />

        <property
            name="country"
            type="net.smartlab.web.registry.Country"
            update="true"
            insert="true"
            column="`country`"
            length="2"
        />

        <property
            name="state"
            type="java.lang.String"
            update="true"
            insert="true"
            column="`state`"
            length="150"
        />

        </component>

        <many-to-one
            name="residence"
            class="net.smartlab.web.registry.MailAddress"
            cascade="all"
            outer-join="auto"
            update="true"
            insert="true"
            column="`residence`"
        />

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

        <property
            name="privacy"
            type="boolean"
            update="true"
            insert="true"
            column="`privacy`"
        />

        </joined-subclass>
        <joined-subclass
            name="net.smartlab.web.registry.Corporation"
            table="`corporation`"
            schema="registry"
        >
            <key
                column="`id`"
            />

        <many-to-one
            name="legalSitus"
            class="net.smartlab.web.registry.MailAddress"
            cascade="all"
            outer-join="auto"
            update="true"
            insert="true"
            column="`legalSitus`"
        />

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

        </joined-subclass>

        </joined-subclass>

    </class>

</hibernate-mapping>
New to GrepCode? Check out our FAQ X