Symptom
While using Query.ExecuteFromDB().CommonNode.field, it retrieves the buffer entry instead of the database entry.
Environment
- SAP Hybris Cloud for Customer
- SAP Business ByDesign
- SAP Cloud Applications Studio
Reproducing the Issue
- Open Cloud Applications Studio
- Use Query.ExecuteFromDB().CommonNode.field in absl
- It retrieves the buffer entry
Cause
The function ExecuteFromDB will only return fields and not nodes. You will be able to read fields only on the node on which the query will be fired. This will be mostly relevant for Custom Business Objects and SAP BusinessObject nodes that have an inbuilt query delivered. Also, it offers better performance when queries are used in a long piece of code.
One example:
var result = CustomerQuery.ExecuteFromDB();
var a = result.field; //This will be the database entry.
var b = result.CommonNode.field; //This will still be buffer entry.
If you use the DOT(.) operator on the query result to navigate via an association, you will see buffer data as the dot operator does a retrieve again. Every DOT is interpreted as retrieve which is a default read from buffer from the framework.
Resolution
Please kindly persist last saved data information in a custom BO or in some extension fields on ROOT node and then use ExecuteFromDB().
Keywords
ExecuteFromDB ExecuteFromDBDataOnly buffer ExecuteFromDB() ExecuteFromDBDataOnly() , KBA , AP-RC-BDS-SCR , ByDesign Studio Scripting (ABSL) , How To