How to save foreign key in a foreign key column and how to fetch that key? Pls give me a solution. I read the documentation but couldn’t understand that. Please give me a working code.
There are no “foreign keys” in Backendless. There is a concept of “relations”. Here’s the doc for relation retrieval:
https://backendless.com/documentation/data/android/data_relations_retrieve.htm
Thanks for your reply.
But I am not getting the things clearly so I want working code for saving and retrieving foreign key. If you have please send it to me.
There are examples in the documentation. Have you seen/tried them?
I tried them but still I m facing difficulties to fetch the foreign key
Means I m not getting the objectId of that foreign key.
There are no “foreign keys” in Backendless. When a related object is retrieved, objectId is always included into the response.
Hi Mark,
I understand the concept behind the relationships in Backendless. However, I am surprised that when I request a parent object (without auto-load), the object is fetched without objectId of the child object, which is in relationship. Our problem is, that we only need the objectId of the child, but we do not want to fetch the whole object.
If you wonder why, I have the relationship set as nullable, so I want to know when the parent has no child. Does that make sense or am I missing some kind of relationship retrieve method, that solves our problem? Because now I have to cancel the relationship in DB and mock it with string objectId. That’s awkward.
Thank you.
Hi Jiří Mauritz,
Sorry for the delay with answer.
Things are exactly like this, you have to load whole relation object instead of getting only id of object.
It is how relations mechanism works.
Regards Ilya