Support Topics Documentation Slack YouTube Blog

Loading relation of relation problems

Hi guys,

I have a problem with loading relations of relations. In my table ‘MetaData’, I have a column named ‘User’ which is a relation to the ‘Users’ table.
In the ‘Users’ table there is a column which is a relation to the table ‘UserRole’. When I now try to load entries from my ‘MetaData’ table, I get the user object in my entries, but not the ‘UserRole’ object in the ‘User’ object.
This worked definetly some time ago. Havent touched the code since month.

I tried to load the UserRole in different ways, as you can see below, but the UserRole object is never in the returned data.

var DbData = (await Backendless.Persistence.of('MetaData').find(Backendless.DataQueryBuilder.create().setWhereClause(WhereClause).setRelated(['User', 'UserRole', 'User.UserRole']).setRelationsDepth(3).setSortBy(["ID DESC"]).setPageSize(100).setOffset(0)));

I know that a relation depth of 2 should be enougth, but also 3 and above does not work…

1 Like

Hi @jonas-eberhard

I just tried it in my app in REST Console, and everything seems work properly

try to check your request in the REST Console

and also could you please provide your appId.

Regards, Vlad

btw this .setRelationsDepth(3) is not necessary, and you can use only User.UserRole here .setRelated(['User.UserRole'])

Hi Jonas

I just tried to load data from eightcloud_AcquisitionMetaData table and the server returns error:

{
	"code": 1054,
	"message": "Column 'ATimestamp' does not exist in table 'eightcloud_AcquisitionMetaData'"
}

Regards, Vlad

Ok my last post was wrong, I deleted it.

The missing user role seems to be a problem of one specific user from the users table.
All other user relations load the UserRole relation without any problem, but all entries in my eightcloud_AcquisitionMetaData table with relations to this one specific user, do not load the UserRole relation.

It’s the user with the objectId: 2DB9A8FE-AD43-6A10-FFCA-59ECBF4DDE00

My app id is: 63087FF7-7E1D-973D-FF3B-D5F0740FA100

could you please send me login/password of the user as a private message and I will try to login in REST Console and take a look

The problem has been fixed, it was a cache issue, we’re going to release it as soon as possible.

Regards, Vlad

1 Like

Hi @jonas-eberhard

We’ve just updated cloud servers with a fix for the issue you described above. Could you kindly let us know whether fix works for you well?

Anton

Seems to be fixed, as I saw in a quick test.

Until now I used a workaround to load the users separate from the data and merge them afterwards, which is also a lot faster (about 1/3 of the time). I might stay with this solution.

But I’ll let you know when I encounter problems with relations again.