-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: is this mapping file correct ?
PostPosted: Tue Mar 30, 2004 1:34 am 
Regular
Regular

Joined: Thu Dec 25, 2003 12:33 am
Posts: 58
Location: Campina Grande, Brasil
please, anybody: is this mapping file ok? my doubts are specially in the subclasses pieces.
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
    PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<!--
default-cascade="save-update
-->

<hibernate-mapping>

<!-- TABELA CLIENTE -->

    <class name="beans.sup.Cliente" table="clientes">

        <id name="id" column="id" type="java.lang.Long" unsaved-value="null" >
            <generator class="native"/>
        </id>       
       

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

    <property name="endereco">
            <column name="endereco"  not-null="true"/>
        </property>


        <property name="numero">
            <column name="numero"  not-null="true"/>
        </property>

   <property name="bairro">
        <column name="bairro" not-null="true"/>
        </property>

   <property name="complemento">
          <column name="complemento" not-null="true"/>
        </property>

   <property name="cidade">
          <column name="cidade"  not-null="true" />
        </property>

   <property name="estado">
          <column name="estado"  not-null="true"/>
        </property>

   <property name="cep">
          <column name="cep"  not-null="true"/>
        </property>


   <property name="telefone">
          <column name="telefone"  not-null="false"/>
        </property>

   <property name="celular">
          <column name="celular"  not-null="true"/>
        </property>

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

<!--#################INICIO DE SUBCLASSE TITULAR#################### -->
   <subclass name="beans.Titular" >
               <property name="cpf" not-null="true"/>
               <property name="telComercial" not-null="true"/>
               
   <set name="dependentes" inverse="true"  cascade="all" lazy="true" order-by="nome asc">
            <key column="id_titular"/>
            <one-to-many class="beans.Dependente"/>
        </set>                  
               
   <set name="planos" inverse="true"  cascade="all" lazy="true" order-by="nome asc">
            <key column="id_titular"/>
            <one-to-many class="beans.Plano"/>
        </set>
     </subclass>

<!--#################INICIO DE SUBCLASSE DEPENDENTE#################### -->
   <subclass name="beans.Dependente" >
               <property name="cpf" not-null="true"/>
               <property name="telComercial" not-null="true"/>
   <many-to-one name="titular" column="id_titular"/>
     </subclass>

    </class>
   
<!-- ###############FIM DE CLIENTE E SUBCLASSES############### -->   



<!-- TABELA PLANO -->

    <class name="beans.Plano" table="planos">

        <id name="id" column="id" type="java.lang.Long" unsaved-value="null" >
            <generator class="native"/>
        </id>       
       

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

    <property name="tipo">
            <column name="tipo"  not-null="true"/>
        </property>


    <property name="codigo">
            <column name="codigo"  not-null="true"/>
        </property>

    <property name="valor">
            <column name="valor"  not-null="true"/>
        </property>


   <many-to-one name="titular" column="id_titular"/>

</class>

</hibernate-mapping>

thanks

_________________
Ot


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 30, 2004 9:38 am 
Beginner
Beginner

Joined: Tue Jan 27, 2004 8:25 am
Posts: 45
Maybe you are missing the discriminator values?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.