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

FCT (JIRA) noreply at atlassian.com
Thu Feb 5 10:39:40 EST 2009


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

FCT commented on HHH-1123:
--------------------------

this other method invoke translateIn(...). He check if is necessary get newQuery:

private static Object execute(final Collection<?> values,
		final Query query, final String param, final boolean select) {
	if ((values != null) && !values.isEmpty()) {
		if (values.size() <= 1000) {
			// if less than or equal 1000 execute default mode
			query.setParameterList(param, values);

			return select ? query.list() : query.executeUpdate();
		}

                                          //Translate in to ins. get new query
		final Query newQuery = translateIn(values, query, param);
                                           
                                          //execute select or delete-update
		return select ? newQuery.list() : newQuery.executeUpdate();
	}

	return null;
}


> 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: Bug
>          Components: core
>    Affects Versions: 3.1 rc2, 3.2.0.alpha1
>         Environment: Oracle 9i
>            Reporter: Alexis Seigneurin
>         Attachments: patch.txt
>
>   Original Estimate: 1 hour
>  Remaining Estimate: 1 hour
>
> 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.
-
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