Backendless 4 relations

I have tables Advertisement and Photo, and I have one-to-many relation
I can’t save Advertisement without photo
Steps:

  1. save Photo
  2. save Adverisement
  3. set relations
    so I have to make 3 requests, but in 3 step, I get an exception (lose internet connection for example), so I’ve created Advertisement without photo
    How can I handle this case?

In Backendless 3, I was able to save by one request

Add exception handling and try again.

Ok, I can handle an exception, but if user lose internet connection at 3 step, and in database was saved Adverisement without Photo
User can reconect hour later

After you save Photo, get its objectId and add it as a property to Advertisement. That way Advertisement will always have a reference to Photo.

thanks a lot, I’ll try

If I have a list of Photos?

Same logic

Sorry, but I don’t understand, shoud I save a List of Strings?

You could create one string:

“a,b,c…”

Or create a json string. Or whatever else you are comfortable with.

My data structure is on photo

  1. How can I save a string?
  2. Can I save List of objects by one request (for example 3 Photo)?

To save a string, add a property of type string.

You cannot save multiple objects in a single request.