Backendless Support
 
Waiting for user's response

Server Processing

Hi, I'm saving data into a table in a for loop, it saves some objects but for some, it gave an error "Server.Processing"

I guess the for loop creates the problem, as I try to save the data (for loop limit -> 2) and it works fine. What should I do if I want to save multiple data objects ?

Here is my code for saving data

  1. for (int i = 0; i <userSkillsObjectList.size() ; i++) {

    HashMap userSkillRating = new HashMap();

    userSkillRating.put("skill", userSkillsObjectList.get(i));

    userSkillRating.put("user", response);

    userSkillRating.put("skillRating", 0);

    Backendless.Data.of("UserSkillRating").save(userSkillRating, new AsyncCallback<Map>() {

    @Override

    public void handleResponse(Map response) {

    }

    @Override

    public void handleFault(BackendlessFault fault) {

    Log.d("regis:",fault.getCode()+"\n"+fault.getMessage());

    makeToast("error in inserting UserSkillBridge");

    }

    });//UserSkillRating-insertion

    }//for

And here is fault code and fault message which backendless returns

  1. Server.Processing
  2. java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction

Leave a Comment

Comments (6)

photo
1

Is it with version 3 or 4 of Backendless?

photo
1

It is 3

photo
1

How many objects in the collection? Does it always fail on the same object?

photo
1

It fails on more than two objects.

photo
1

And on more than two objects, it doesn't fail on every object, it fails on some of them.

photo
1

Hi Mubtada,

Please prepare a minimal verifiable sample app so that we could reproduce and fix the problem. It can also be a simple one-file java program, not necessarily an Android project. You may attach it here or send to support@backendless.com with a link to this topic.