[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1774?page=c...
]
Steve Ebersole commented on HHH-1774:
-------------------------------------
Note, Anthony, that as a work-around your failing test could simply reverse the
parameters:
from Order o where o.customer.name =:name and o.id = :id
which works fine.
The issues comes up whenever a parameter to be bound follows the named component parameter
in the HQL string...
Component parameters bound incorrectly
--------------------------------------
Key: HHH-1774
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1774
Project: Hibernate3
Type: Bug
Components: query-hql
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
Assignee: Steve Ebersole
Fix For: 3.2.1
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira