他の場所で作業しているコードと (少なくとも構造的に) ほぼ同一のコードで興味深いエラーが発生しています。「Notes エラー: エントリがインデックスに見つかりません」というエラーが表示され、while ループのViewNavigator.getNext(ViewEntry)の行で発生します。私はこれについて明らかな何かを見逃しているように感じます.
[更新] autoUpdate を false に設定することに関する Jesse のメモはうまくいきました。このループ中にループが別のドキュメント (同じ DB、異なるビュー) に保存されるため、2002 年のこのテクニカル ノートに関連しているようです。vw.setAutoUpdate(false);
ビューにハンドルを定義した直後に配置することで成功しました。[/アップデート]
グループ化されたドキュメントからの情報を要約するために、(ビュー内の各ドキュメントからのフィールド値を参照して) 単一カテゴリのビューを歩いています。デバッグを有効にした後、最初のカテゴリの最後のドキュメント (Doc の ViewEntry) からカテゴリ (ViewEntry) に戻るトラバーサルでエラーが発生することがわかりました。
これが私のコードの簡素化されたバージョンです (//... は、明確にするために削除された行を示します):
View vw = db.getView("<ViewName>");
ViewNavigator nav = vw.createViewNav();
ViewEntry first = nav.getFirst();
String unid = "";
while(first != null){
if(first.isCategory()){
if(!unid.isEmpty()){
//summarize the info and save it back to the category-relevant doc
Document myDoc = db.getDocumentByUNID(unid);
//doing my thing
boolean success = myDoc.save(true, false);
myDoc.recycle();
}
unid = "";
}
if(first.isDocument()){
Vector<?> colVals = first.getColumnValues();
if(unid.isEmpty()){
//reset temp aggregation vars back to initial value (e.g.- 0)
//...
unid = (String) colVals.get(5); // the value of the category-relevant UNID
}else{
//doing the aggregation of summary values with the temp vars established before and handled after
//...
//perform aggregation from colVals with temp vars
}
session.recycle(colVals);
}
ViewEntry tmp = nav.getNext(first); //this is the line that fails!! only if it's the next category, which there is one
first.recycle();
first = tmp;
}