[hibernate-issues] [Hibernate-JIRA] Commented: (HSEARCH-306) Problem with composite key

Angelos Anagnostopoulos (JIRA) noreply at atlassian.com
Sun Apr 26 07:48:17 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33017#action_33017 ] 

Angelos Anagnostopoulos commented on HSEARCH-306:
-------------------------------------------------

I, too, have faced the same issue, which led me to drop Hibernate Search for a specific project and use "plain" Criteria queries.

The parameters are indeed not passed correctly. Think of each parameter pair (?, ?) as the two ids that compose the composite key for which you want to search.

> Problem with composite key
> --------------------------
>
>                 Key: HSEARCH-306
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-306
>             Project: Hibernate Search
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 3.1.0.CR1
>            Reporter: Mohit Khopkar
>         Attachments: hibernate jira.zip
>
>
> When a composite key is used and more than one results are expected , the values passed to the query are not in a proper expected order.
> In the below query the parameters passed are (A00, A00),(A00, 1),(2,5) ....instead of the correct order which should be (A00,1) ,(A00,2), (A00,5)
> (I have omitted the select part)..
> ..
> where ((this_.key_client, this_.key_identifier) in ((?, ?), (?, ?), (?, ?)))
> I tried to debug this issue and found that in the class org.hibernate.criterion.InExpression, the method getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery)  has 2 for loops , one for types and other for values. I get 2 types CustomType and LongType and so for each type it retrieves the value and adds it in the list in the order A00,A00,A00,1,2,5
> I have attached the source code for your reference.
> For more information, refer to the below topic on the hibernate forums:
> http://forums.hibernate.org/viewtopic.php?t=992121&sid=16e54abb3dbc45d314f528a4646763cc

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