Support Topics Documentation Slack YouTube Blog

can't add array of objects to data table


(Mitchell) #1

Hi Guys,

Getting an error when trying to add an array of objects to data table in production mode, note this works fine in debug mode.

Example

List<NotificationToSend> notificationsArray = new ArrayList<NotificationToSend>();
notificationsArray.add(notification);notificationsArray.add(notification);Backendless.Data.of(NotificationToSend.class).create(notificationsArray);

Error message:

2018-06-26 11:56:55,618 | Coderunner | ERROR | Business logic execution has been stopped, due to error: Code: 0 Class: java.lang.NoSuchMethodError Message: com.backendless.IDataStore.create(Ljava/util/List;)V

Adding individual entries to the table works, but adding the array in one go does not.


(Mitchell) #2

This issue appears to be related to http://support.backendless.com/t/business-logic-works-in-debug-not-in-production


(Vladimir Upirov) #3

Hi Mitchell

Unfortunately, I can’t reproduce it.
I’ve create/download a simple project template
http://support.backendless.com/public/attachments/f7f64eeee88158080f30f2a12b5395a0.png</img>

and add the next code


package com.sample.api;

import com.backendless.Backendless;
import com.backendless.servercode.IBackendlessService;

import java.util.ArrayList;
import java.util.List;

public class DemoService implements IBackendlessService
{
  public List&lt;String&gt; saveComment( )
  {
    List&lt;DemoComment&gt; list = new ArrayList&lt;DemoComment&gt;();
    list.add(new DemoComment());
    list.add(new DemoComment());

    return Backendless.Data.of(DemoComment.class).create(list);
  }
}
                           


I check it in both modes Debug/Prod and it works well.

So, could you please create a minimal project and send it to support@backendless.com and we will
try to reproduce your issue

Regards, Vlad