0

I got a panel which bind to an open document as data source called document1 in an extlib dialog box. On button save, I want to compare all the field values between back-end document and document1. However, all the field values from back-end document are seemed to be updated therefore their field values are the same in document1. The comparison is done before docuemnt1.save().

From my understanding, document1.getDocument() should get the back-end document which all original/current data. document1.getDocument(true) should get all new data. I had try to getDocumentByID and found that all field values are updated in back-end document. I have no idea because document1.save not yet executed.

Why back-end document being updated with new data before save?

Is there any better way to get back-end document which all original/current data?

4

1 回答 1

2

如果您在getDocument方法中使用参数true,则对数据源所做的所有更改都会临时写入数据源的数据存储区。

XPages 引擎“足够聪明”,可以实现NotesDocument对象的多个实例都引用同一个后端文档。它现在将从数据源的数据存储中返回缓存的数据。这就是为什么所有对象现在都将返回更新的值,而不是存储在后端文档中的值(使用多个数据源会得到相同的结果)。

要访问后端文档中的数据,您可以在所有文档按其 UNID 排序的视图上使用@DbLookup 。

@DbLookup("","AllByUNID", document1.getDocument( true ).getUniversalID(), "FIELD")
于 2013-01-02T11:00:13.800 回答