Hi!!
Well, the hierarchy is a little bit long, but for this post, here's what matters:
class PrestadorPessoaFisica extends PessoaFisica
Code:
<subclass
name="empresajunior.business.domain.PessoaFisica"
dynamic-update="true"
dynamic-insert="true"
discriminator-value="PF"
>
<property
name="CPF"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="str_cpf"
length="12"
/>
<property
name="dataNascimento"
type="java.sql.Date"
update="true"
insert="true"
access="property"
column="date_nascimento"
/>
<component
name="RG"
class="empresajunior.business.domain.RG"
>
<property
name="numero"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="str_rg_numero"
length="11"
/>
<property
name="orgaoEmissor"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="str_orgao_emissor"
length="15"
/>
</component>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-PessoaFisica.xml
containing the additional properties and place it in your merge dir.
-->
<subclass
name="empresajunior.business.domain.PrestadorPessoaFisica"
dynamic-update="true"
dynamic-insert="true"
discriminator-value="PF"
>
<set
name="habilitacao"
lazy="false"
inverse="false"
cascade="all-delete-orphan"
sort="unsorted"
>
<key
column="oid_pessoa"
>
</key>
<one-to-many
class="empresajunior.business.domain.Habilitacao"
/>
</set>
<set
name="tipoVinculo"
table="VINCULACAO"
lazy="false"
inverse="false"
cascade="none"
sort="unsorted"
>
<key
column="oid_pessoa"
>
</key>
<many-to-many
class="empresajunior.business.domain.TipoVinculo"
column="oid_tipo_vinculo"
outer-join="auto"
/>
</set>
class Prestador
Code:
<class
name="empresajunior.business.domain.Prestador"
table="PRESTADOR"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
>
<id
name="oid"
column="oid_pessoa"
type="java.lang.String"
length="32"
>
<generator class="uuid.hex">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-Prestador.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
<discriminator
column="subclass"
length="2"
/>
<set
name="habilitacao"
lazy="false"
inverse="false"
cascade="all-delete-orphan"
sort="unsorted"
>
<key
column="oid_pessoa"
>
</key>
<one-to-many
class="empresajunior.business.domain.Habilitacao"
/>
</set>
<set
name="tipoVinculo"
table="VINCULACAO"
lazy="false"
inverse="false"
cascade="none"
sort="unsorted"
>
<key
column="oid_pessoa"
>
</key>
<many-to-many
class="empresajunior.business.domain.TipoVinculo"
column="oid_tipo_vinculo"
outer-join="auto"
/>
</set>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Prestador.xml
containing the additional properties and place it in your merge dir.
-->
</class>
So here's what I don't get, I see PrestadorPessoaFisica being a subclass of PessoaFisica in the mappings, but i don't know where should I tell hibernate that PrestadorPessoaFisica implements Prestador
Thanks in advance,
Thiago Souza[/code]