[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-1774) Component parameters bound incorrectly
Steve Ebersole (JIRA)
noreply at atlassian.com
Mon Oct 16 11:13:26 EDT 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1774?page=all ]
Steve Ebersole updated HHH-1774:
--------------------------------
Summary: Component parameters bound incorrectly (was: Wrong SQL generated from a composite-id HQL.)
Fix Version: 3.2.1
Version: (was: 3.2.0.cr3)
(was: 3.2.0.cr4)
(was: 3.1.3)
(was: 3.2.0 cr1)
(was: 3.2.0.cr2)
Assign To: Steve Ebersole
The original issue was actually implemented quite early on in 3.2 development. I do not have the issue # by which I was tracking that feature request. However, Anthony's comments do show an issue in this code. Namely, binding of multi-column named parameters is currently not being handled correctly.
> 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.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list