Relation type update is prohibited-property location must relate to table GeoPoint not LinkedTreeMap

I am trying to relate a Custom Object ( NewWish ) with a BackendlessUser Object . But when I try to do so , I get the error as :
Relation type update is prohibited - property location must relate to table GeoPoint but not LinkedTreeMap
My Code goes like this :

Backendless.Data.mapTableToClass("location", GeoPoint.class);
Backendless.Data.mapTableToClass("original_poster", BackendlessUser.class);
passedobject.setOriginalPoster(originalPoster); //original Poster is retrieved from local cache

Backendless.Data.of(NewWish.class).save(passedobject, new AsyncCallback<NewWish>() {
 public void handleResponse(NewWish response) {
 public void handleFault(BackendlessFault fault) {
 Log.i("Fault", fault.getMessage());

What gets really interesting is that I am able to update a User to Geopoint Relation through the same BackendlessUser object without any issue, but it is giving me problem when I related a “NewWish” object to an user object. When I print my original Poster as JSON I get it as :

 UserBackendlessUser{location={categories=[Default], latitude=27.684932393494325, longitude=84.42940793931484, metadata={Location=Bharatpur 44200}, objectId=75FE414B-3601-393B-FF15-BF57EAA54500}, Display_name=पाग्ल मुन्छे , __meta={"relationRemovalIds":{},"selectedProperties":["fb_email","searchradius","created","Display_name","___savedRelations","ownerId","pro_pic_url","__meta","password","__relatedschemageopoint","___class","name","location","updated","objectId","email"],"relatedObjects":{"location":["75FE414B-3601-393B-FF15-BF57EAA54500"]}}, pro_pic_url=, lastLogin=Mar 7, 2016 10:58:34 AM,, updated=Mar 7, 2016 11:00:02 AM, created=Mar 6, 2016 2:04:59 PM, objectId=4C1061A0-A1DE-77F0-FF95-114185D48600, userStatus=ENABLED, searchradius=800}

Please help me as this is getting me really stuck .

A few things about your code:

Backendless.Data.mapTableToClass(“location”, GeoPoint.class);
Bad idea, this actually does not make sense since GeoPoints are stored in its own storage, not in a table.

Backendless.Data.mapTableToClass(“original_poster”, BackendlessUser.class);
Instances of BackendlessUser must be stored ONLY in the table called Users. This mapping is not necessary and will leave to nothing but problems.

Backendless.Data.mapTableToClass(“location”, GeoPoint.class);

Backendless.Data.mapTableToClass(“original_poster”, BackendlessUser.class);

Okay , I removed both the lines from my code. Actually I didn´t had it before. I just put in for the shake of something might happen .

My data schema goes like : NewWish has a relation column original_poster which maps to User while User has a relation column of location which maps to GeoLocation.
What I noticed by testing is that when I don’t make changes to Location table of an instance of user , the problem doesn’t occur and I can easily set the instance of current user in original_poster of current data object.

So when does the problem occur then?

Somewhere before the step , I do a task A :
A: ) Retrieve the current logged in Backendless User and set currentuser.setProperty(location´,mygeo); // mygeo is a geopoint here . . And Do Backendless.UserService.update on that intance. And later on that same object I do setOriginalPoster(currentUser); and Do Backendless.Persistence.Save on the customNewWish´ object.
The case here is :
When I don’t do step A , everything works cool.
P.S If You have better approaches / design pattern to solve this scenario, please suggest . :slight_smile:

is “mygeo” object an instance of com.backendless.geo.GeoPoint ?

Yes. I have it as :
GeoPoint mygeo=new GeoPoint(80.35,66.45);
mygeo.setMetadata(address´,Somewhere on earth´);

Could you please attach a screenshot of the User Properties from Backendless Console? (Users > User Properties screen).


Dear Mark,

Here it Goes , Sorry I got the field name written wrong. It is ‘location’ instead of 'mygeo '. Now, where might it have gone wrong. Please help :slight_smile:</img>

Hi Pujan,

I put together a sample that does the following:

  1. Logs in a user
  2. Adds “location” property to the user with the value of GeoPoint
  3. Sets the user object as a property in another object, which is then saved
BackendlessUser user = Backendless.UserService.login( "", "password" );
user.setProperty( "location", new GeoPoint( 0, 0 ) );
Person person = Backendless.Data.of( Person.class ).findFirst();
person.user = user;
Backendless.Data.of( Person.class ).save( person );

This works just fine for me.

Try verifying in a debugger what the NewWish object contains right before you save it.