Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.2
Please pardon me for not including the other details. I've walked through the involved code and most of the details are no relevant.
When doing a query like this:
Code:
SELECT c.m_contentId FROM PSComponentSummary c, PSState s
WHERE c.m_contentId in (:ids) AND
c.m_workflowAppId = s.workflowId AND
c.m_contentStateId = s.stateId AND
s.contentValidValue in (:flags)
we can run out of parameters when :ids (or similar parameters) contain many ids. Ids or similar for us is some sort of Collection. The problem stems from Hibernate rewriting these clauses like this (in part):
Code:
(c.m_contentId = ? OR c.m_contentId = ? ....)
where each ? is a single value. Since each comparison consumes a parameter, and since at least some JDBC drivers (Oracle and jTDS at least) have a limited number of parameters, this ends up throwing an exception from deep within the affected JDBC driver.
I have considered workarounds by using a table holding the ids with a join, which would work around the problem. Yet this seems like an issue that the library should be considering.
I'll note, for those interested, that leaving it as an in clause can run into problems as well. Oracle needs the use of in-array if there are more than 2000 elements. But that seems a better defined set of constraints for the dialect to encode.