[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-960?page=co...
]
Stefan Fleiter commented on HHH-960:
------------------------------------
The JUnit-Testcase shows the bug is still present in Hibernate 3.2.0 GA.
What can be done to speed up or start investigation of this failure?
It would realy be nice if a Hibernate developer could state his optinion about this!
Thanks a lot in advance.
Incorectly bound parameters in HQL
----------------------------------
Key: HHH-960
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-960
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.1 beta 2
Environment: hibernate 3.1 beta 2 and beta3 (presumable other as well)
Reporter: Misko Hevery
Attachments: Component.hbm.xml, ComponentProperty.hbm.xml, ComponentValue.hbm.xml,
HibernateBug960.zip, junit_testcase_HHH960.patch
I have a HQL:
==========
select
stack.serialNo as stackSN,
v_p_stack_seal_strips.text as stack_Seal_Strip,
v_p_size.number as size
from
com.sigmaquest.gen.model.Component as stack
left join stack.containedComponents as cell with cell.componentKind=:kind_cell
left join stack.values as v_p_stack_seal_strips with
v_p_stack_seal_strips.componentProperty=:p_stack_seal_strips
left join cell.values as v_p_size with v_p_size.componentProperty=:p_size
where
stack = :stack
==========
This gets translated to SQL (on oracle)
==========
select
component0_.serialNo as col_0_0_,
values2_.val_text as col_1_0_,
values3_.val_number as col_2_0_
from
GEN_COMPONENT component0_
left outer join GEN_COMPONENT containedc1_ on
component0_.ID=containedc1_.containerComponent_id
and (containedc1_.componentKind_id=?)
left outer join GEN_COMPONENT_VALUE values3_ on containedc1_.ID=values3_.component_id
and (values3_.property_id=?)
left outer join GEN_COMPONENT_VALUE values2_ on component0_.ID=values2_.component_id
and (values2_.property_id=?)
where
component0_.ID=?
==========
The transaltion is correct (with some caviats)
named bindigs are:
1 :kind_cell
2 :p_stack_seal_strips
2 :size
4 :stack
When these get bound to SQL in the above order the SQL is actualy reversed.
SQL binding order!
SQL ?1?: containedc1_ is :kind_cell CORRECT
SQL ?2?: values3_ is :p_size gets bound to :p_stack_seal_strips WRONG
SQL ?3?: values3_ is :p_stack_seal_strips gets bound to :p_size WRONG
SQL ?4?: component0_.ID=? is :stack CORRECT
Needless to say executing the query produces garabage.
As far as I can tell the problem is in the way AST transaltes HQL to SQL. It does not
always keep the order of the operands as in the above example. I don't understand
hibernate codebase sufficiently enough to point you closer to the problem. This bug is a
blocker and I am happy to provided any examples/code necesary to reproduce
-- Misko(a)hevery.com
--
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