Limitations for "auto load"

Hello,

Are there any known limitations for the “auto load” functionality when using the android/java sdk?
Example:
I have a Request class. This class has a User member. In turn, the User member references a BackendlessUser.

With any query function (findById, findFirst, findLast) the BackendlessUser comes null.
When i do a query from the Backendless Console, same field is not empty.

All fields have “auto load” enabled in the Console.
I’m using Backendless Standalone 3.0.0-16.

Thank you,
Mihai

Hello, Mihai!

No, there should be no limitations. I shall try to reproduce it.
For now can you try to pass parameter “relationsDepth” to the method and check if the response contains related user?
best regards,
Alex

Hi Alex,

I have tried with relations depth: 1, 10, 100, Integer.MAX_VALUE (the last one was just to make sure).
Same result.

Action last = Backendless.Persistence.of(Action.class).findLast(Integer.MAX_VALUE); 
System.out.println(new ObjectMapper().writeValueAsString(last)); 
 



And here is the output (i couldn’t add a file)


{
	"objectId": "D18A5612-8296-614B-FF3F-C5E01A3F8200",
	"created": 1455218214000,
	"updated": null,
	"status": "PENDING",
	"owner": {
		"objectId": "97BACB69-73F9-268C-FFA9-056E886B9900",
		"created": 1454976000000,
		"updated": 1455218214000,
		"user": null,
		"supervisor": {
			"objectId": "11199C50-B15D-F1C2-FFEA-F8B4136C1400",
			"created": 1454976000000,
			"updated": 1455218214000,
			"user": {
				"properties": {
					"created": 1454976000000,
					"updated": 1455218214000,
					"email": "<email>",
					"ownerId": null,
					"objectId": "84D92F96-365A-1118-FFBF-816EFD8B0E00",
					"name": null,
					"___class": "Users"
				},
				"objectId": "84D92F96-365A-1118-FFBF-816EFD8B0E00",
				"password": null,
				"userId": "84D92F96-365A-1118-FFBF-816EFD8B0E00",
				"email": "<email>"
			},
			"supervisor": null,
			"email": "<email>",
			"userType": "HR_4",
			"name": "User 4HR"
		},
		"email": "<email>",
		"userType": "HR_3",
		"name": "User 3HR"
	},
	"supervisor": {
		"objectId": "11199C50-B15D-F1C2-FFEA-F8B4136C1400",
		"created": 1454976000000,
		"updated": 1455218214000,
		"user": {
			"properties": {
				"created": 1454976000000,
				"updated": 1455218214000,
				"email": "<email>",
				"ownerId": null,
				"objectId": "84D92F96-365A-1118-FFBF-816EFD8B0E00",
				"name": null,
				"___class": "Users"
			},
			"objectId": "84D92F96-365A-1118-FFBF-816EFD8B0E00",
			"password": null,
			"userId": "84D92F96-365A-1118-FFBF-816EFD8B0E00",
			"email": "<email>"
		},
		"supervisor": null,
		"email": "<email>",
		"userType": "HR_4",
		"name": "User 4HR"
	}
}

Thank you,
Mihai

To me, auto load is a last resort.
I would always try to avoid it for performance reasons.

It’s always faster to have all data fetched with a simple query on indexed fields.

While this is a valid statement, when you have a large tree structure, it’s easier to use auto load, than to search manually for each individual field, on each branch.

Another issue appears when you need to save the parent structure, after changing one or more properties, but you somehow forgot to retrieve some properties down the hierarchy and those are saved with a null.

Then things could get messy.

As I see from json you’ve posted - class Action has related “owner”, and “owner” has related “user”, which is null. Are you sure that this “owner” really has related user?
I’m asking because I see that related “supervisor” also has “user” which is not null, and the “owner” also has “supervisor”, which has “user” which is also not null. So, I can guess that all related objects are loaded, and one “user” is null because it doesn’t exist.
Can you please check in console if “owner” with objectId “97BACB69-73F9-268C-FFA9-056E886B9900” really has not null “user”?

Mihai, don’t worry - service is built in the way that while updating only changed values would change. For example, if you have “Parent” object with related “Child” objects and you want to change “parents” name - you’re not able to retrieve parent object with all his relations. Just retrieve “parent”, change name, and save. After that name would be changed, but relations would be kept.

In order to change relation - you should manually set it to null in your code and then save.

Double-checked, the user is there.

However i’ve made a small mistake in my description. The Rest Console DOES exhibit the same issue/behavior.

Also, i could not replicate the issue on the environment from “develop.backendless.com”.


{
	"objectId": "97BACB69-73F9-268C-FFA9-056E886B9900",
	"created": 1454976000000,
	"updated": 1455218214000,
	"user": {
		"properties": {
			"created": 1454976000000,
			"updated": 1455216203000,
			"email": "<email>",
			"ownerId": null,
			"objectId": "8D70AB97-56BA-3125-FFC3-F934DE212F00",
			"name": null,
			"___class": "Users"
		},
		"password": null,
		"objectId": "8D70AB97-56BA-3125-FFC3-F934DE212F00",
		"userId": "8D70AB97-56BA-3125-FFC3-F934DE212F00",
		"email": "<email>"
	},
	"supervisor": {
		"objectId": "11199C50-B15D-F1C2-FFEA-F8B4136C1400",
		"created": 1454976000000,
		"updated": 1455218214000,
		"user": {
			"properties": {
				"created": 1454976000000,
				"updated": 1455218214000,
				"email": "<email>",
				"ownerId": null,
				"objectId": "84D92F96-365A-1118-FFBF-816EFD8B0E00",
				"name": null,
				"___class": "Users"
			},
			"password": null,
			"objectId": "84D92F96-365A-1118-FFBF-816EFD8B0E00",
			"userId": "84D92F96-365A-1118-FFBF-816EFD8B0E00",
			"email": "<email>"
		},
		"supervisor": null,
		"email": "<email>",
		"userType": "HR_4",
		"name": "User 4HR"
	},
	"email": "<email>",
	"userType": "HR_3",
	"name": "User 3HR"
}

http://support.backendless.com/public/attachments/a69694d58b4146bf9827616194c95c41.PNG</img>

Can you please export data from your standalone installation and send me the archive at alex.navara@themidnightcoders.com so I can investigate it?

Sure. i’ll upload it as soon as it’s ready.

Thank you,
Mihai

For some reason, i cannot export the data from the standalone installation. I never receive the email that the export zip is ready.

However, i’ve managed to duplicate the issue on the "https://develop.backendless.com"; environment.
App ID “1222D486-2545-0202-FF20-4EF37F88FA00”.

It’ not identical, but it’s similar. From the 3rd level, using auto load, the reference is null.

This is the query for the first user: 60C43B24-F233-4E56-FF57-F7EB27505400

https://api.backendless.com/v1/data/User/60C43B24-F233-4E56-FF57-F7EB27505400

the ANG_1 user has an OP_2 supervisor (63D3AEAF-DEA9-8C89-FFF2-E67C78C32400)
the OP_2 user has an HR_3 supervisor (A515545F-B609-28FA-FFE5-E83872C55200)
the HR_3 user has an HR_4 supervisor (1C8A5028-00BE-0D1E-FF22-66F9C0012E00)
the HR_4 user has no supervisor

{
 "created": 1454594731000,
 "name": "User 1ANG",
 "___class": "User",
 "userType": "ANG_1",
 "ownerId": null,
 "updated": 1454869335000,
 "user": {
 "created": 1454594731000,
 "name": null,
 "___class": "Users",
 "ownerId": null,
 "updated": 1454869335000,
 "email": "adecco.romania@11degrees.ro",
 "objectId": "672A879C-EAA2-0114-FFBE-60DABC680400"
 },
 "email": "adecco.romania@11degrees.ro",
 "objectId": "60C43B24-F233-4E56-FF57-F7EB27505400",
 "supervisor": {
 "created": 1454594680000,
 "name": "User 2OP",
 "___class": "User",
 "userType": "OP_2",
 "ownerId": null,
 "updated": 1454869335000,
 "user": {
 "created": 1454594680000,
 "name": null,
 "___class": "Users",
 "ownerId": null,
 "updated": 1454869335000,
 "email": "adecco.uae@11degrees.ro",
 "objectId": "63573F63-CA5B-ECAC-FF4D-7056BBCB3E00"
 },
 "email": "adecco.uae@11degrees.ro",
 "objectId": "63D3AEAF-DEA9-8C89-FFF2-E67C78C32400",
 "supervisor": <THIS SHOULD BE A REFERENCE TO A515545F-B609-28FA-FFE5-E83872C55200>
 },
 "__meta": "{\"relationRemovalIds\":{},\"selectedProperties\":[\"__updated__meta\",\"created\",\"name\",\"___class\",\"userType\",\"ownerId\",\"updated\",\"user\",\"email\",\"objectId\",\"supervisor\"],\"relatedObjects\":{\"user\":[\"672A879C-EAA2-0114-FFBE-60DABC680400\"],\"supervisor\":[\"63D3AEAF-DEA9-8C89-FFF2-E67C78C32400\"]}}"
}

I’ve marked the place where the reference chain breaks.
This is why i was asking if there any limitations when using auto load.

Hope i provided enough info to replicate the observed issue/behavior.
If by any change i have misunderstood or misread the documentation, i apologize.

Thank you for your support,
Mihai

Have you checked your data tab in the console? The Export should be there, even if you don’t get the email.

Would it be possible to run export on your app in the cloud?

@Jens, you mean the Files screen, right?

Yes. I don’t get the mail too but in the file tab in backendless console I can access the ZIP.

Got the export from the cloud app. I’ve attached it.

export_2016_02_12_20_07_51.zip (3.28kB)

Email problem solved. The server was not configured in backendless.config. I didn’t know i have to configure there as well.

Any updates on the auto-load behavior ?

Thank you for the export. We’ve reproduced this problem and working on it now.

Thank you for the update.

Best regards,
Mihai