Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » SQLServerException: Some part of your SQL statement is nested too deeply.
SQLServerException: Some part of your SQL statement is nested too deeply. [message #1001724] Thu, 17 January 2013 09:32 Go to next message
Patrick Haun is currently offline Patrick HaunFriend
Messages: 30
Registered: October 2009
Member
Hi,

I use the criteria builder to create a query. The query has a huge amount of parameters. I use this method:

final Predicate[] array;
criteriaBuilder.or(array);

Instead of using OR to concatenate the predicates it creates a nested query.

Shortened example:
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((APPL_INST = ?) OR (APPL_INST = ?)) OR (APPL_INST = ?)) OR (APPL_INST = ?)) OR (APPL_INST = ?)) OR (APPL_INST = ?)) OR (APPL_INST = ?)) OR (APP


In this case I could use IN but not in all cases the APPL_INST is the only parameter.

Re: SQLServerException: Some part of your SQL statement is nested too deeply. [message #1001883 is a reply to message #1001724] Thu, 17 January 2013 14:09 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Perhaps break up your query into multiple queries, or find a more efficient way to query without a huge number of parameters.


James : Wiki : Book : Blog : Twitter
Re: SQLServerException: Some part of your SQL statement is nested too deeply. [message #1001895 is a reply to message #1001883] Thu, 17 January 2013 14:23 Go to previous messageGo to next message
Patrick Haun is currently offline Patrick HaunFriend
Messages: 30
Registered: October 2009
Member
I will do that but I'm curious if there is a way to adjust this behavior. The nesting is not necessary for the statement.
Re: SQLServerException: Some part of your SQL statement is nested too deeply. [message #1004082 is a reply to message #1001895] Tue, 22 January 2013 14:49 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Using an IN would avoid all of the ORs.

James : Wiki : Book : Blog : Twitter
Re: SQLServerException: Some part of your SQL statement is nested too deeply. [message #1004096 is a reply to message #1004082] Tue, 22 January 2013 15:12 Go to previous messageGo to next message
Patrick Haun is currently offline Patrick HaunFriend
Messages: 30
Registered: October 2009
Member
I get that an IN would work. But it just delays the problem. On Oracle IN is limited to 1000 parameters. It's not that I'm not working on a solution to reduce the high amount of parameters. I just don't understand why the query is nested.
Re: SQLServerException: Some part of your SQL statement is nested too deeply. [message #1004107 is a reply to message #1004096] Tue, 22 January 2013 15:29 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Brackets are used to maintain the order of operations. With all of them OR it is not obvious, but if you mix in AND and other operations, the brackets are required.


James : Wiki : Book : Blog : Twitter
Re: SQLServerException: Some part of your SQL statement is nested too deeply. [message #1005754 is a reply to message #1004107] Mon, 28 January 2013 15:01 Go to previous message
Patrick Haun is currently offline Patrick HaunFriend
Messages: 30
Registered: October 2009
Member
The code that creates this:
final Predicate[] array;
criteriaBuilder.or(array);


The brackets could be around the ORs because there can't be an AND. There's no nesting required.
Previous Topic:Eclipselink is reverting my LAZY settings
Next Topic:TABLE_PER_TENANT
Goto Forum:
  


Current Time: Mon Dec 22 10:51:29 GMT 2014

Powered by FUDForum. Page generated in 0.05699 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software