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
nobuoiwamotonobuoiwamoto 

「QueryLocator を使用しますが、これは無効です」とのエラーを検知する方法

 

いつもお世話になっております。

 

StandardSetController絡みで質問させてください。

現在、StandardSetController内にQueryLocatorを設定して、ページング処理を実装しております。

 

このときに、最初に表示してから15分程度画面を放置しておいた状態で、StandardSetController.next()を

呼び出すと、「このページは QueryLocator を使用しますが、これは無効です。 QueryLocator はユーザあたり

5 個という制限があります。」というエラーが、ページ全体に表示されてしまいます。

 

このエラーは、再度StandardSetControllerをnewすれば直るのですが、StandardSetController.next()を

呼び出した際に、Exceptionクラスでcatchしても全くcatchできておりません。

#これは憶測ですが、Apexコード側ではなくVisualforceページ側でエラーが発生しているような気がします。

 

 

ちなみに、英語ページを確認したところ、このようなページがありましたが、残念ながら解決方法は見出せて

いないようです。

 

http://forums.sforce.com/t5/Visualforce-Development/Working-around-quot-This-page-uses-a-QueryLocator-that-is/td-p/170382

 

サンプルソース:

Apexpages.StandardSetController ssController;

public void init() {
ssController = new Apexpages.StandardSetController(Database.getQueryLocator(sql));
}


public void next() {
try {
ssController.next();
} catch(Exception e) {
System.debug(e.getMessage());
}
}

 

 

エラーを検知する方法をご存知の方がおりましたら、教えていただけると幸いです。

よろしくお願い致します。

 

 

ssController = new Apexpages.StandardSetController(Database.getQueryLocator(sql + condition + order));