The content from pagination returns empty

Faqtt0 :

Using PagingAndSortingRepository the content returns with {} and right number of content from page url parameter. Example: My table has 20 rows and in url a put ?page=0&size=10. When returns in the postman the key content return

    "content": [
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {}
    ]

Debuging the request and return it has values. But is not showing. Don't know why.

my repository

public interface LocalUtilRepository extends PagingAndSortingRepository<LocalUtilModel, Integer> {
    Page<LocalUtilModel> findAll(Pageable pageable);
}

Spring boot version

<artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.6.RELEASE</version> 

The result from request

{
    "content": [
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {}
    ],
    "pageable": {
        "sort": {
            "sorted": false,
            "unsorted": true,
            "empty": true
        },
        "offset": 0,
        "pageNumber": 0,
        "pageSize": 10,
        "unpaged": false,
        "paged": true
    },
    "totalPages": 2,
    "totalElements": 11,
    "last": false,
    "size": 10,
    "number": 0,
    "sort": {
        "sorted": false,
        "unsorted": true,
        "empty": true
    },
    "numberOfElements": 10,
    "first": true,
    "empty": false
}

My model

   @Entity(name = "EXPLOCALUTIL")
public class LocalUtilModel {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @NotNull
    @Size(min = 5, max = 255)
    @Column(name = "DESCLOCALUTIL")
    private String descLocalUtil;

    @Column(name = "COORD")
    private String coordenada;

    private String referencia;

    @NotNull
    @Column(name = "IDEXPFEIRA")
    private Integer idExpFeira;
} 
Faqtt0 :

I had to annotate with @Data in model class because I'm using lombok.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=162345&siteId=1