Issue with bulk create in boolean fields

When I save a single object in my Android app using Backendless.Persistence.of(MyClass::class.java).save(object) is working fine.

But when I save multiple objects with Backendless.Persistence.of(MyClass::class.java).create(listObject) or Backendless.Data.of(MyClass::class.java).create(listObject), all boolean fields are saved in Backendless table as their default values (as setted in schema) and not as my values.

eg. if default value of column “isOnline” is FALSE and I set my object.isOnline = TRUE, the object is saved as FALSE.

application ID C7E4D6B0-688D-F07A-FF85-8F60722C2600

Thanks!

@Ryta_Kulikowsky direct message are allowed only for the customers with payed support plan. So I will make your topic public if you do not mind?

ok i don’t mind

Hey @Ryta_Kulikowsky

Unfortunately we were not able to reproduce the behavior you described. What we’ve tried:

  1. REST request to create objects in bulk on a clean app
  2. Tried same on your application
  3. Tried 1 and 2 with and without default value for boolean property
  4. Tried via latest Android SDK

None of these steps resulted in that kind of error, boolean property was always set according to what value was in request. Code snippets below:

REST - curl -X POST -H 'Content-Type:application/json' 'https://api.backendless.com/<appID>/<restKey>/data/bulk/TestTable' -d '[{"isOnline":true}]'

List bulkList = new ArrayList();
        Employee employee = new Employee();
        employee.setOnline(true);
        bulkList.add(employee);


        Backendless.Data.of(Employee.class).create(bulkList, new AsyncCallback<List<String>>() {
            @Override
            public void handleResponse(List<String> response) {
                System.out.println(response);
            }

            @Override
            public void handleFault(BackendlessFault fault) {
                System.out.println(false);
            }
        });

I believe we’d need a minimal code sample of yours in order to reproduce the problem

Anton

This s my class:
data class Test (
var isOnline:Boolean?=null,
var nome:String?=null,
var objectId:String?=null
)

This is the code:
private fun setPointer() = GlobalScope.launch(Dispatchers.IO) {
val test = mutableListOf<Test>()
for (i in 1…10){
test.add(Test(i%2==0,“Hello, Backendless”))
}

Result on Debug:
test = {ArrayList@5394} size = 10
0 = {Test@5432} “Test(isOnline=false, nome=Hello, Backendless, objectId=null)”
1 = {Test@5433} “Test(isOnline=true, nome=Hello, Backendless, objectId=null)”
2 = {Test@5434} “Test(isOnline=false, nome=Hello, Backendless, objectId=null)”
3 = {Test@5435} “Test(isOnline=true, nome=Hello, Backendless, objectId=null)”
4 = {Test@5436} “Test(isOnline=false, nome=Hello, Backendless, objectId=null)”
5 = {Test@5437} “Test(isOnline=true, nome=Hello, Backendless, objectId=null)”
6 = {Test@5438} “Test(isOnline=false, nome=Hello, Backendless, objectId=null)”
7 = {Test@5439} “Test(isOnline=true, nome=Hello, Backendless, objectId=null)”
8 = {Test@5440} “Test(isOnline=false, nome=Hello, Backendless, objectId=null)”
9 = {Test@5441} “Test(isOnline=true, nome=Hello, Backendless, objectId=null)”

Result in Backendless:

Hi, Ryta.
Have you tried to save list of objects using Java method?
As i understood you use Kotlin? So could you please to perform saving process with both languages to determine where the problem is?

I made the program in Java and persists the same error:

My Java class:

public class Test
{
private java.util.Date created;
private Boolean isOnline;
private String objectId;
private java.util.Date updated;
private String ownerId;
private String nome;

… getters and setters …
}

My Main activity:

private void setPointer() {
List<Test> tests = new ArrayList<>();

for (int i = 0; i<10;i++){
Test temp = new Test();
temp.setNome(“Hello, BackEndless”);
temp.setIsOnline(i%2==0);
tests.add(temp);
}

Backendless.Data.of(Test.class).create(tests, new AsyncCallback<List<String>>() {
@Override
public void handleResponse(List<String> response) {
Toast.makeText(MainActivity.this, “Yes”, Toast.LENGTH_SHORT).show();
}

@Override
public void handleFault(BackendlessFault fault) {
Toast.makeText(MainActivity.this, fault.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}

And the result in Backendless NULL

I can’t understand.
Please, help!

I took your code and ran it on both my app and your app. All records have correct boolean value after saving.
Can i ask you to try with entirely new simple android app with only one Activity and only one method that perform creation and saving instances of ‘Test’ class.
if the problem is still reproduced, please send us this simple project entirely as is.

That is exactly what I did.
I’m using last backendless api 5.2.4 and Android Studio 3.4.1.
https://drive.google.com/open?id=1Mk-QVf-duT_-Cb8RTHFfWaQoPy1lm4cD
Here is the entire project

Any news in my issue?:disappointed_relieved:

Hi @Ryta_Kulikowsky

I was now able to reproduce the problem with create bulk API in Android environment. I’ve scheduled a task to fix the problem. For reference ticket ID is - BKNDLSS-19016. Sorry for the inconveniences it may have caused

Anton

1 Like

How can I know when this problem will be fixed? How can I consult this task?

Hello, Ryta!

This ticket is done, but we need to test it well, I think it’ll be ready on Monday.

Denys

1 Like