Skip to content

Duplicates items after filtering #142

@sebasira

Description

@sebasira

I having and issue with an Entity that has a @ManyToMany association. It's a Store and a StoreCategory many stores can be associated to many categories.

I have an Specification to search (like) the associated categories. And after:

dataTablesOutput = dataTableRepository.findAll(input, allColumnsSpecs);

I have this:
Screen Shot 2022-01-08 at 11 49 42

As you can see i have 2 recordsTotal and 3 recordsFiltered so after filtering I have more records than the total. And as you can see, items 0 and 1 are the same Entity.

What I'm doing to solve this is remove duplicates like this:

List<Integer> listWithDuplicates = Lists.newArrayList(5, 0, 3, 1, 2, 3, 0, 0);
List<Integer> listWithoutDuplicates = new ArrayList<>(
      new LinkedHashSet<>(listWithDuplicates));

Is this a bug or am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions