Support Topics Documentation Slack YouTube Blog

Unable to set up relation

I need help to set up the relation between 2 tables but i am gettting error

here is my code

  String jobConstant = "A-PGEB-04261-";

PartTimeJobs partTimeJobs = new PartTimeJobs();

                     partTimeJobs.setStudentName(studentName.getText().toString().trim());
                     partTimeJobs.setJobNumber(jobConstant.concat(codeNumber.getText().toString().trim()));

                     PartTime partTime ;
                     final ArrayList<PartTimeJobs> userJobs = new ArrayList<>();
                     userJobs.add(partTimeJobs);


                             Backendless.Data.of( PartTime.class ).setRelation(partTime, "partTimeJobs", userJobs,
                                     new AsyncCallback<Integer>() {
                                         @Override
                                         public void handleResponse(Integer response) { 
                                             Toast.makeText(EnterJobs.this, "Success", Toast.LENGTH_SHORT).show();
                                             finish();
                                         }

                                         @Override
                                         public void handleFault(BackendlessFault fault) {
                                             Toast.makeText(EnterJobs.this, "Inside relation "+somethingWentrong + "   "+fault.getMessage(), Toast.LENGTH_LONG).show();

                                         }
                                     });

Hi @Saad_Zahoor1

What kind of an error message are you getting? Please show the complete error output

Anton

The “partTime” object you use as a parent is not initialized in the code you showed.

Regards,
Mark