UserServiceException thrown attempting to save user after updating a 1:N relationship property

This is very helpful. I am working on this as we “speak”. I will share my findings soon.

Regards,
Mark

Btw, as I am working on this, I noticed that your code with the lookup of “me” can be significantly simplified like this:

List<String> related = new ArrayList<String>();
related.add( "contacts.user" );
BackendlessUser me = Backendless.Persistence.of( BackendlessUser.class ).findById( objectId, related, 2 );

Regards,
Mark

Mark,

Great tip! Thank you.

Hi Ian,

I was able to reproduce the problem and get exactly the same exception. We are working on a resolution.

Regards,
Mark

Hi Ian,

I noticed that the following call helped get rid of the exception. Could you please try it on your end as well and let me know if it worked for you:

Backendless.Data.mapTableToClass( “Contact”, Contact.class );

Make sure this call takes place early on, perhaps right after you do Backendless.initApp.

Regards,
Mark

Hi Mark,
I just tried that and actually started seeing a NullPointerException in the try…catch where I persist the user, which, at the moment, I do not have time to debug and explore more.

I’ll have to take a look at this later tonight to try and get you more information. Saving a HeyStaxContact[] with the added contact to the user’s “contacts” property, vs. attempting to save a List<HeyStaxContact>, is currently working.

-Ian

Hi Ian,

I think the best place to put the Backendless.Data.mapTableToClass call is the same service method where you save the user object. Please try that (in case if you had it elsewhere). I have a working service and we should be able to compare my implementation with yours and see what the differences are. Let’s get on the phone tomorrow morning and work it out.

Regards,
Mark

Hi Ian,

Have you had a chance to try my suggestion?

Regards,
Mark

Hi Mark,
Sorry to say I haven’t, I had a bit of a rough morning and have been doing bug fixes for some other team mates today. I will definitely work on this later this evening and let you know what I run into, if anything.

-Ian

No problem. Whenever you get to it is fine. It has been one of the most puzzling issues around here and we just finally want to get to the closure… ))