2

I am currently upgrading my project to spring data couchbase 4.0.0 and I am now experiencing problems when I want to save a Object with a list. I am not sure if there is an error in my code or this is a bug, but I could not find any informationen about this.

I have a simple user object with an attribute role, which is an ArrayList. The user gets an role added and the save method is called. The interface userService Repository extends PagingAndSortingRepository and the normal save method is called, which worked before 4.0.0 perfectly.

user.getRole().add("ROLE_USER");
user.getRole().forEach(System.out::println);
//Save User in DB
this.userService.save(user);

The Object user is saved correctly, all attributes are saved except the List. The comment list was empty and the true is also correct, role is empty false but without data.

  "comment": {
    "empty": true
  },
  "role": {
    "empty": false
  },

Did something change with the new version or I am doing something wrong?

Meister96Fels
  • 508
  • 1
  • 8
  • 26
  • I'm having the exact same issue and the docs indicate that no special handling is required: https://docs.spring.io/spring-data/couchbase/docs/4.0.0.RELEASE/reference/html/#datatypes – jgitter Jun 07 '20 at 16:24

1 Answers1

3

There is a bug with the new version of spring data couchbase 4.0.0 with saving of list/maps.

According to documentation spring data couchbase should support saving document with lists and composed objects, but it doesn't.

The full bug report can be found here: Spring Jira Bugs - Document with list and composed object serialization works improperly

Meister96Fels
  • 508
  • 1
  • 8
  • 26