Query on polyphomic association
-------------------------------
Key: HHH-4504
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4504
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.2.6
Environment: MySQL 5.0.51a-community-nt
Reporter: Rafael Santini
The following query on a polyphormic association does not works:
from Pessoa where nome = 'Rafael';
Error: Unknown column 'pessoa1_1_.nome' in 'where clause'
Mapping:
<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>
SQL generated by Hibernate:
select cliente0_.id as id18_, cliente0_.id_pessoa as id2_18_ from bs_erp_cliente
cliente0_, bs_com_pessoa pessoa1_ where cliente0_.id_pessoa=pessoa1_.id and
(pessoa1_1_.nome like ?) order by pessoa1_1_.nome
There is not pessoa1_1_ in the from clause.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira