[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-3303) Parameters bound in wrong order for IN-clauses on dynamic components

Holger Engels (JIRA) noreply at atlassian.com
Fri Aug 8 07:17:31 EDT 2008


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3303?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Holger Engels updated HHH-3303:
-------------------------------

    Attachment: Entity.java

> Parameters bound in wrong order for IN-clauses on dynamic components
> --------------------------------------------------------------------
>
>                 Key: HHH-3303
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3303
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: query-criteria
>    Affects Versions: 3.2.6
>            Reporter: Holger Engels
>         Attachments: BugTest.java, Entity.java, HibernateBug.hbm.xml
>
>
> When issuing the following query, the parameters are bound in wrong order:
>         List<Map> keys = Arrays.asList(CollectionUtil.map("mandator", "M", "key", "test"), CollectionUtil.map("mandator", "M", "key", "user"));
>         list = session.createCriteria(Profile.class).add(Restrictions.in("key", keys)).list();
>         // list.size() = 0, should be 2
> [DEBUG] 15:24:45 [org.hibernate.SQL        ]: select this_.id as id7_0_, this_.version as version7_0_, this_.key_mandator as key3_7_0_, this_.key_key as key4_7_0_, this_.created as created7_0_, this_.createdBy as createdBy7_0_, this_.modified as modified7_0_, this_.name as name7_0_ from auth_profile this_ where (this_.key_mandator, this_.key_key) in ((?, ?), (?, ?))
> Hibernate: select this_.id as id7_0_, this_.version as version7_0_, this_.key_mandator as key3_7_0_, this_.key_key as key4_7_0_, this_.created as created7_0_, this_.createdBy as createdBy7_0_, this_.modified as modified7_0_, this_.name as name7_0_ from auth_profile this_ where (this_.key_mandator, this_.key_key) in ((?, ?), (?, ?))
> [DEBUG] 15:24:45 [nate.jdbc.AbstractBatcher]: preparing statement
> [DEBUG] 15:24:45 [hibernate.type.StringType]: binding 'M' to parameter: 1
> [DEBUG] 15:24:45 [hibernate.type.StringType]: binding 'M' to parameter: 2
> [DEBUG] 15:24:45 [hibernate.type.StringType]: binding 'test' to parameter: 3
> [DEBUG] 15:24:45 [hibernate.type.StringType]: binding 'user' to parameter: 4
> It should be:
>    binding 'M' to parameter: 1
>    binding 'test' to parameter: 2
>    binding 'M' to parameter: 3
>    binding 'user' to parameter: 4
> The mapping for key is:
>         <dynamic-component name="key" unique="true">
>             <property name="mandator" column="key_mandator" type="string" length="4"/>
>             <property name="key" column="key_key" type="string" length="16"/>
>         </dynamic-component>
> Interestingly, the same query works in HQL:
>         Query query = session.createQuery("from Profile where key in (:keys)");
>         query.setParameterList("keys", keys);
>         list = query.list();
>         // list.size() = 2

-- 
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