<?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="jm28.Cliente" table="cliente">

        <id name="id">
            <column name="ID" not-null="true"/>
            <generator class="identity"/>
        </id>

        <property name="nome">
            <column name="NOME" length="50" not-null="true"/>
        </property>

        <property name="email">
            <column name="EMAIL" length="30" not-null="true"/>
        </property>

        <property name="sexo">
            <column name="SEXO" length="30" not-null="true"/>
        </property>

        <component name="endereco">
            <property name="logradouro">
                <column name="LOGRADOURO" length="30" not-null="true"/>
            </property>
            <property name="numero">
                <column name="NUMERO" not-null="true"/>
            </property>
            <property name="complemento">
                <column name="COMPLEMENTO" length="15" not-null="false"/>
            </property>
            <property name="bairro">
                <column name="BAIRRO" length="20" not-null="true"/>
            </property>
            <property name="municipio">
                <column name="MUNICIPIO" length="30" not-null="true"/>
            </property>
        </component>

        <many-to-one name="categoria" column="CATEGORIA"
             class="jm28.Categoria" cascade="save-update"/>

        <set name="telefones" table="TELEFONES_CLIENTE" cascade="all">
            <key column="CLIENTE"/>
            <element column="NUMERO" type="string"/>
        </set>

    </class>

</hibernate-mapping>
