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 ? :-)