spring-data-jpa

Spring-Data-JPA with QueryDslPredicateExecutor and Joining into a collection

狂风中的少年 提交于 2020-11-30 04:30:04
问题 Let's say I have a data model like this (pseudocode): @Entity Person { @OneToMany List<PersonAttribute> attributes; } @Entity PersonAttribute { @ManyToOne AttributeName attributeName; String attributeValue; } @Entity AttributeName { String name; } I have a Spring-Data-JPA repository defined such as: public interface PersonRepository extends PagingAndSortingRepository<Person, Long>, QueryDslPredicateExecutor<Person>{} I see in the QueryDSL documentation that there is a mechanism to Join from

Retrieve global index of element with pagination JPA Postgresql

拜拜、爱过 提交于 2020-11-29 21:20:51
问题 In my project there is a service that retrieves a list of documents. Till now the way to retrieve them is with pagination object this way we don't send back to frontend all the elements. public Page<Document> findDocumentPage(Pageable pageable) { return this.documentService.findAllByPage(pageable); } The problem is that I need the global index of a document from all pages. For example lets say I have a list of pages with results after query: firstResult:{ page: 1, document_list: [{doc:{ id: a

Retrieve global index of element with pagination JPA Postgresql

会有一股神秘感。 提交于 2020-11-29 21:02:52
问题 In my project there is a service that retrieves a list of documents. Till now the way to retrieve them is with pagination object this way we don't send back to frontend all the elements. public Page<Document> findDocumentPage(Pageable pageable) { return this.documentService.findAllByPage(pageable); } The problem is that I need the global index of a document from all pages. For example lets say I have a list of pages with results after query: firstResult:{ page: 1, document_list: [{doc:{ id: a