-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: exhausting jdbc parameters with large collection
PostPosted: Mon Jan 29, 2007 5:14 pm 
Beginner
Beginner

Joined: Thu Sep 15, 2005 4:16 pm
Posts: 29
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.


Top
 Profile  
 
 Post subject: Found a related hibernate bug
PostPosted: Mon Jan 29, 2007 6:23 pm 
Beginner
Beginner

Joined: Thu Sep 15, 2005 4:16 pm
Posts: 29
At least I believe this is the same problem, or perhaps a related problem?

http://opensource.atlassian.com/projects/hibernate/browse/HHH-1123


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.