function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Balu_devBalu_dev 

Invalid Query Locator while running batch class..

Iam getting Invalid Query Locator while running batch class, this is the query, urgent help will be appreciated..thanks

 

public string query = 'Select l.Id, l.Discount_Rollup__c, l.Car_Van_Type__c, (Select Product__c, Product_Key_Model_Discount_Level__c, Product_Key_Model__c From Line_Item_Products__r where Product_Key_Model__c >0), (Select Discount__c, Account_Id__c From Deal_Line_Items__r where deal_active__c > 0) From Line_Item__c l';

 

While running this query in eclipse and explorer no issues...but after running the batch it gives the above error.

I dont understand whether this is a bug in salesforce or we have any fix for it.. Tried checking forums and blogs but no,luck.. If anyone facing this issue and had done some fix , please share thoughts, really help me..

Starz26Starz26

First result from a google search of "salesforce invalid query locator" I believe will answer your question:

 

http://www.interactiveties.com/b_batch_apex_invalid_query_locator.php

 

 

Balu_devBalu_dev

Hi,

 

I have already tried solution in the link which says to use  getSobjects but how do i use in my scenario?

like my code is like this,

for(lineitem li : lineItems)

{

for(lineitemprod lip :li.lineItemproducts__r)

{

}

}

 

So How do i replace to iterate my child records ??Please suggest me..

 

Starz26Starz26

here is another discussion on the issue. not sure if it is resolved or not...

 

http://boards.developerforce.com/t5/Apex-Code-Development/Spring-11-Batch-Apex-System-QueryException-Inline-query-has-too/td-p/246317

 

try the suggestion in the last post