[hibernate-issues] [Hibernate-JIRA] Issue Comment Edited: (HHH-1123) Cannot put more than 1000 elements in a InExpression

Siddharth Shankar (JIRA) noreply at atlassian.com
Thu Dec 1 01:26:19 EST 2011


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

Siddharth Shankar edited comment on HHH-1123 at 12/1/11 12:24 AM:
------------------------------------------------------------------

I agree that there is no all purpose solution to this but what I also believe is that this is a general problem that should be addressed by a library code. A user can choose to use it or not to use it but the users should be provided with that choice. 
In addition to the use cases mentioned in the above comments, a user should be able to use the Restriction.in(String, Collection) without having to worry about the size of the collection (which he receives from another service) exceeding say n elements. This is for cases where the user expects the collection to be of size 5-100 usually but occassinally say 1000 but never 10000 (so the user validates that the size doesn't exceed 10000). The user code stays clean. The library can log a warning in cases where it considers that there are too many sub sets for in clause or if it forsees a problem or lack of support for a particular dialect instead of failing on all occassions(for n>1000).

      was (Author: siddharth.star):
    I agree that there is no all purpose solution to this but what I also believe is that this is a general problem that should be addressed by a library code. A user can choose to use it or not to use it but the users should be provided with that choice. 
In addition to the use cases mentioned in the above comments, a user should be able to use the Restriction.in(String, Collection) without having to worry about the size of the collection exceeding say n elements. This is for cases where the user expects the collection to be of size 5-100 usually but occassinally say 1000 but never 10000. The user code stays clean. The library can log a warning in cases where it considers that there are too many sub sets for in clause or if it forsees a problem or lack of support for a particular dialect instead of failing on all occassions(for n>1000).
  
> Cannot put more than 1000 elements in a InExpression
> ----------------------------------------------------
>
>                 Key: HHH-1123
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1123
>             Project: Hibernate Core
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 3.1 rc2, 3.2.0.alpha1
>         Environment: Oracle 9i
>            Reporter: Alexis Seigneurin
>            Assignee: Strong Liu
>         Attachments: Animal.hbm.xml, hibernate-inexpression-oracle-3.2.patch, HQLHelper.java, LongInElementsTest.java, patch.txt
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> The number of elements that we can put in a "in" expression is limited to a certain amount (1000 for Oracle, for instance). When creating a criteria query, the org.hibernate.criterion.InExpression class should split the expression into several smaller ones.
> Attached is a patch which splits the expression by slices of 500 elements. For example, if we have 1001 elements to put in the "in" expression, the result would be :
> (entity.field in (?, ?, ?...) or entity.field in (?, ?, ?...) or entity.field in (?))
> The surrounding parantheses are useful to avoid problems with other conditions (a "and" condition taking over the one of the "or" conditions).

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