how long can spring hibernatetemplate createSQLQuery where in(..) can be?
is there any limi开发者_Go百科t of statement i can use where in(1,2,3,4,5,6....) in createSQLQuery in spring hibernatetemplate() ?
As mentioned, Oracle has a limit. One workaround is to execute multiple queries, each with a subset of the IN parameters. The other is to use an OR in the clause: where column in (:firstsubset) or column in (:secondsubset) or ...
Some databases also have a limit on the total SQL string length. I've never run into that with Oracle, but wouldn'be surprised.
Yes, but said limit is not caused by Hibernate or Spring but rather underlying database.
For example, Oracle AFAIK allows no more than 1000 items in IN() clause. There are usually also limits on the maximum statement length.
I believe it depends on the underlying database you are using. For example, Oracle used to limit you to 1000 items in an IN clause and I believe it still does, but I'm not certain. What is your database?
精彩评论