jpa

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

Spring Boot JPA: Passing Multiple Values for the Same Parameter (JPQL)

岁酱吖の 提交于 2020-11-28 02:15:14
问题 I'm using JPQL to write SQL queries in JPA's CurdRepository interface. I was able to write more than one query with named parameters and they work like a charm. However, my application requires that I match an unknown number of strings with more than one column in a table. To my knowledge, in SQL it'd look something like this: SELECT * FROM TABLE WHERE COLUMN_1 LIKE "%string_1%" OR COLUMN_1 LIKE"%string_2%" ... OR COLUMN_2 LIKE "%string_1%" OR COLUMN_2 LIKE "%string_2%" ... ... I tried this

Spring @Transactional on @Bean declaration instead of class Implementation

南笙酒味 提交于 2020-11-26 14:52:39
问题 I'd like to configure "transactional" beans from my Spring @Configuration class instead of annotating the class implementation itself with @Transactional . Kind of like the old school way, configuring transactional advice from an XML file, but without needing a String reference to my class/method names to create pointcuts. The reason is that the bean implementation is in another code base, and the module it belongs to doesn't depend on Spring. Read : I'm not touching the source code of that