i been having some issues when i save the data. here is my scenario:
3 data object
phonebook , contact , contact_number
phonebook can have multiple contact
contact can have multiple contact_number
- i have an existing contact with 2 contact number(contact number A and B) . it is successfully created and store in database. but this contact is not added to phonebook.
- under certain situation , i want to add this contact to phonebook. When i add this contact to the phonebook. it successfully add , but the contact number gets duplicated. so i have 4 contact number linked to contact.
i’m confused here . any thoughts?
using Backendless.Persistence.save( xxx , new AsyncCallback<xxx>() ) to save. with java custom object
where/how do you get
contact object to save it in phonebook? Do you previously get it from server or use same object you created before?
The point is that the objects can be duplicated only if the saved object (no matter how similar to the existing it is) no field
objectId, the server perceive it as a new object and thus “duplicates” (in fact - will really create new, with the same fields, except the objectId).
To avoid this, you must firstly obtain an object from a server (
contact), and then add it to a phonebook.
the contact object is retrieve from server with valid object id.
only the phonebook object is new and not created before.
the workaround i made now is
- create a new phonebook object first
- then assign the contact object.
this seems like double work and call.
Could you please provide us code sample how you’re doing it? I’ve reproduced same table schema and scenario, but can’t reproduce issue. This would help us to find the problem.