I'm trying to perform the following query on a polymorphic association:
from Pessoa where nome = 'Rafael';
But
Unknown column 'pessoa1_1_.nome' in 'where clause' error is raised.
The mapping is:
Code:
<class name="Pessoa" table="bs_com_pessoa">
<id name="id" type="java.lang.Long">
<generator class="native"/>
</id>
<joined-subclass name="PessoaFisica" table="bs_com_pessoa_fisica">
<key column="id_pessoa"/>
<property column="nome" name="nome" not-null="true"/>
</joined-subclass>
<joined-subclass name="PessoaJuridica" table="bs_com_pessoa_juridica">
<key column="id_pessoa"/>
<property name="razaoSocial" column="razao_social" not-null="true"/>
<property name="nomeFantasia" column="nome_fantasia" not-null="true"/>
</joined-subclass>
</class>
<class name="Cliente" table="bs_erp_cliente">
<id name="id" type="java.lang.Integer">
<generator class="native"/>
</id>
<many-to-one name="pessoa" class="Pessoa" column="id_pessoa" not-null="true" unique="true" cascade="all"/>
</class>
This query is supported? What I'm missing?
Thanks