I have the mapping below.
DescricaoMaterial has two subclasses: DescricaoMadeira and DescricaoEucalipto.
How can I select only objects from DescricaoMaterial class? I don't want to get instances from DescricaoMadeira and DescricaoEucalipto.
Code:
<hibernate-mapping>
<class name="src.model.DescricaoMaterial"
table="DESCRICAO_MATERIAL"
discriminator-value="DescricaoMaterial">
<id name="id" column="DESCRICAO_MATERIAL_ID">
<generator class="sequence">
<param name="sequence">
DESCRICAO_MATERIAL_GEN
</param>
</generator>
</id>
<discriminator column="TIPO" />
<version name="versao" column="VERSAO" />
<property name="nome" unique="true" not-null="true" />
<property name="unidadeMedida" column="UNIDADE_MEDIDA"
not-null="true" />
<property name="preco" />
<subclass name="src.model.DescricaoMadeira"
discriminator-value="DescricaoMadeira">
<property name="largura" />
<property name="altura" />
<property name="comprimento" />
<many-to-one name="materialPrimario"
column="MATERIAL_PRIMARIO_ID" lazy="false" fetch="join" />
</subclass>
<subclass name="src.model.DescricaoEucalipto"
discriminator-value="DescricaoEucalipto">
<property name="altura" />
<many-to-one name="materialPrimario"
column="MATERIAL_PRIMARIO_ID" lazy="false" fetch="join" />
</subclass>
</class>
</hibernate-mapping>