cancel
Showing results for 
Search instead for 
Did you mean: 

No data returned on first GET requests after node.js restart

former_member611349
Discoverer
0 Kudos

Hello SAP community,

I'm trying to build an application on a local area network SAP HANA installation using only the SAP Web IDE. In my data model I have several types of data objects (e.g. activities, players) which can be linked to eachother by using "tagging".

To achieve this I create tables for the objects (here 2) and another table to manage the tags like here:

    entity activities {
        key id   : Integer generated always as identity(start with 1 increment by 1);
            name : String(30);
    };

    entity players {
        key id   : Integer generated always as identity(start with 1 increment by 1);
            name : String(30);
    };

    entity players_activities_assignment {
        key id         : Integer generated always as identity(start with 1 increment by 1);
            playerId   : Integer;
            activityId : Integer;
    };

The data is exposed via .xsodata in a node.js module. I'm using a Calculation Views to add additional data to the objects (e.g. ActivityCalculationView) and the assignments (e.g. acitivityPlayerTags; without using seperate id) from other tables, which worked fine so far.

Since the list of tags can be of any length from 0 to n I wasn't really able to create a column in the Calculation View with the list of tags (this would be the equivalent to putting a table inside the cell of a table). I found out I could solve that problem by using association in the .xsodata file:

service {
	"x.xx::activityPlayerTags" as "ActivityPlayerTags" keys generate local "GenID";
	"x.xx::ActivityCalculationView" as "Activities" key ("id") navigates ("APtags" as "playerTags");
	association "APtags" principal "Activities"("id") multiplicity "1" dependent "ActivityPlayerTags"("activityId") multiplicity "*";

The solution works pretty fine, but since I implemented it, whenever I restart the node.js module there is no data in my application until I refresh it (probably doing another GET request to the backend). For every other association I added to the application afterwards, the number of refreshes needed to get the data on screen increases. I experience the same problem using Postman. This is the message I get before I sent enough GET requests:

{
    "error": {
        "code": 500,
        "message": {
            "lang": "en-US",
            "value": "Keys cannot be specified for source as it is a table object."
        }
    }
}

The problem seems to be connected to the associations in the .xsodata. I wonder if anyone has an idea what I'm doing wrong here?

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member611349
Discoverer
0 Kudos

I found the cause, but it was outside the provided code examples.

As the error message states, I didn't assign any keys to intermediate CalculationViews. The number of refreshes needed to see data in the ui was exactly the same as the the number of CalculationViews without specified keys in the .xsodata.