[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-1774) Wrong SQL generated from a composite-id HQL.
Anthony Patricio (JIRA)
noreply at atlassian.com
Wed Oct 4 06:09:25 EDT 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1774?page=all ]
Anthony Patricio updated HHH-1774:
----------------------------------
Attachment: CompositeIdTest.java
> Wrong SQL generated from a composite-id HQL.
> --------------------------------------------
>
> Key: HHH-1774
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1774
> Project: Hibernate3
> Type: Bug
> Components: query-hql
> Versions: 3.1.3, 3.2.0 cr1, 3.2.0.cr2
> Environment: Hibernate 3.1.3 / 3.2.0 cr1 / 3.2.9 cr2
> Database: PostgreSQL 8.0 and Oracle 7.3.4
> Reporter: Regis Pires Magalhaes
> Priority: Blocker
> Attachments: CompositeIdTest.java
>
>
> Hibernate is generating a wrong SQL related to a composite-id HQL.
> The details of the problem are described below...
> MAPPING:
> <hibernate-mapping>
> <class name="Cobrador" table="cobrador">
> <composite-id name="id" class="CobradorId">
> <key-property name="empresa"/>
> <key-property name="matricula"/>
> </composite-id>
> <property name="nome" type="string"/>
> </class>
> </hibernate-mapping>
> HQL:
> from Cobrador cobrador
> where cobrador = :cobrador
> GENERATED SQL:
> select cobrador0_.empresa as empresa3_,
> cobrador0_.matricula as matricula3_,
> cobrador0_.nome as nome3_,
> from cobrador cobrador0_
> where (cobrador0_.empresa, cobrador0_.matricula)=?
> PARAMETERS BINDING:
> DEBUG 13/05/2006 10:32:18 [org.hibernate.type.IntegerType:80] - binding '1' to parameter: 1
> DEBUG 13/05/2006 10:32:18 [org.hibernate.type.IntegerType:80] - binding '1234' to parameter: 2
> Note that 2 parameters are binded, but there is just a single parameter in the generated SQL.
> DATABASE EXCEPTION:
> org.postgresql.util.PSQLException: The column index is out of range: 2, number of columns: 1
> The generated SQL should be:
> select cobrador0_.empresa as empresa3_,
> cobrador0_.matricula as matricula3_,
> cobrador0_.nome as nome3_,
> from cobrador cobrador0_
> where (cobrador0_.empresa, cobrador0_.matricula)=(?, ?)
--
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