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
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
Server.Processing
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