-->
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.  [ 1 post ] 
Author Message
 Post subject: HBM2DDL problem with subclass and not null property on subcl
PostPosted: Wed Sep 28, 2005 4:47 pm 
Regular
Regular

Joined: Mon Jun 14, 2004 1:42 pm
Posts: 80
Location: Brazil
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
tools aplha 6
Mapping documents:
Code:
   <class
      name="Pessoa"
      table="Pessoa"
   >   


      <id
         column="idPessoa"
         name="idPessoa"
         type="java.lang.Integer"
      >
         <generator class="increment">
         </generator>
      </id>   
   <discriminator
      column="TipoPessoa"
      type="string"

   />   
      <property
         name="Nome"
         column="Nome"

         type="string"
         not-null="true"
        >
      </property>
   </class>
   <subclass
      name="PessoaJuridica"
        extends="Pessoa"
      discriminator-value="PessoaJuridica"
   >   

      <property
         name="CNPJ"
         type="java.lang.Integer"
         not-null="true"
        >
      </property>
</subclass>
   <subclass
      name="Partido"
        extends="PessoaJuridica"
      discriminator-value="Partido"
   >   

      <property
         name="Sigla"
         type="string"
         not-null="true"
        >
      </property>

Description:
I defined 3 classes, each one is a subclass discriminated by value:
C extends B extends A.
I defined C property 'x' as not null.
HBM2DDL is generating not null constraint for x, but it isn't right, becouse objects B and A will not have this property. And it worked fine on hibernate 2.
Am I right or should I change something in mapping ? :-)

_________________
Alexandre Torres
--------------------


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

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.