Oracle knows the limitation to 1000 elements in the where a in (..)
clause. Does this limitation also exist when using Hibernate in conjuction with Oracle?
views:
536answers:
3Yes as Hibernate will call Oracle at some stage so the limit is the lowest of the limits in Hibernate and Oracle
Hibernate does nothing special with data for an in - just passes it to the database
This database limitation still exists with hibernate. If you really need to have more than 1000 items in your in clause you will have to split the list yourself in the code and run the query for each block of 1000 keys, then append the result sets together.
Note this hack breaks down if your query needs to sort or otherwise aggregate the results of the query because the full set of results will only be known in the code. In this case you are better of finding another way to write the query that does not require an IN
clause.
It seems to be a Bug in Hibernate:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1123