[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2038) Invalid SQL generated for HQL on a Map

Daniel Serodio (JIRA) noreply at atlassian.com
Tue Aug 29 19:03:24 EDT 2006


Invalid SQL generated for HQL on a Map
--------------------------------------

         Key: HHH-2038
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2038
     Project: Hibernate3
        Type: Bug

  Components: query-hql  
    Versions: 3.0.5    
 Environment: Hibernate 3.0.5, HypersonicSQL 1.8.0.4
    Reporter: Daniel Serodio
 Attachments: hbm-bug-with-map.zip

I have two classes linked by a bidirectional one-to-many, and a Map<String,String> on the "many" side.
When I run the following HQL query (using Hibernate Tools), the generated SQL has the correct "joins", but doesn't include the table for the "many" side in the "from" clause .

from Cheque as cheque
where cheque.situacoes.contexto['foo'] = 'bar'

Gives:

Column not found: SITUACOES1_.SITUACAO_ID in statement [select cheque0_.id as id0_ from cheque cheque0_, dados_contexto contexto2_ where situacoes1_.situacao_id=contexto2_.situacao_id and contexto2_.chave = 'foo' and cheque0_.id=situacoes1_.cheque_id and contexto2_.valor='bar']

If I add change the query to

from Cheque as cheque
inner join cheque.situacoes as situacoes
where cheque.situacoes.contexto['foo'] = 'bar'

The generated SQL is different, but the error is the same:

Column not found: SITUACOES1_.SITUACAO_ID in statement [select cheque0_.id as id0_0_, situacoes1_.situacao_id as situacao1_1_1_, situacoes1_.data_inicio as data2_1_1_, situacoes1_.data_fim as data3_1_1_, situacoes1_.cheque_id as cheque4_1_1_ from cheque cheque0_ inner join situacoes situacoes1_ on cheque0_.id=situacoes1_.cheque_id, dados_contexto contexto3_ where situacoes2_.situacao_id=contexto3_.situacao_id and contexto3_.chave = 'foo' and cheque0_.id=situacoes2_.cheque_id and contexto3_.valor='bar']

I've searched the forums, and found this similar post: http://forum.hibernate.org/viewtopic.php?p=2320400
I've searched Jira, and found nothing. I've narrowed it down and I'm attaching the relevant files, it should be trivial to duplicate.

-- 
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.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list