[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2866) The order of parameters is not maintained between HQL and SQL, but the parameters are inserted into the PreparedStatement in their HQL order.

Strong Liu (JIRA) noreply at atlassian.com
Thu Oct 13 12:16:21 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2866?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44041#comment-44041 ] 

Strong Liu commented on HHH-2866:
---------------------------------

it seems this is fixed in 4.0, at least the attached test shows that


> The order of parameters is not maintained between HQL and SQL, but the parameters are inserted into the PreparedStatement in their HQL order.
> ---------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-2866
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2866
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: query-hql
>    Affects Versions: 3.2.5
>         Environment: Hibernate 3.2.5.ga; both with MySQLInnoDB and H2 dialects; both with annotations and hand written mapping files
>            Reporter: Benjamin Keil
>            Assignee: Steve Ebersole
>             Fix For: antlr-rework
>
>         Attachments: ReorderedParameters.java, ReorderedParameters.zip
>
>
> The HQL query 
> from Assoc a where a.type.oid = ? and a.constituents[?].oid = ?
> gets translated into
> select
>         reorderedp0_.oid as oid1_,
>         reorderedp0_.type_oid as type2_1_
>     from
>         Assoc reorderedp0_,
>         Assoc_Topic constituen1_,
>         Topic reorderedp2_
>     where
>         reorderedp0_.oid=constituen1_.Assoc_oid
>         and constituen1_.topic_index = ?
>         and constituen1_.constituents_oid=reorderedp2_.oid
>         and reorderedp0_.type_oid=?
>         and reorderedp2_.oid=?
> Where clearly the first and second parameters (the index and the type) have been permuted.
> The relevant thread in the User forum is : http://forum.hibernate.org/viewtopic.php?t=979832
> Attached are a java source file that demonstrates the error, and a zipped maven2 project that supplies the Hibernate, Hibernate-Annotation, H2, and Log4J dependencies.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list