spring-data-jpa

Spring JPA REST sort by nested property

五迷三道 提交于 2021-02-17 21:43:35
问题 I have entity Market and Event . Market entity has a column: @ManyToOne(fetch = FetchType.EAGER) private Event event; Next I have a repository: public interface MarketRepository extends PagingAndSortingRepository<Market, Long> { } and a projection: @Projection(name="expanded", types={Market.class}) public interface ExpandedMarket { public String getName(); public Event getEvent(); } using REST query /api/markets?projection=expanded&sort=name,asc I get successfully the list of markets with

Postgresql - IN clause optimization for more than 3000 values

烈酒焚心 提交于 2021-02-17 06:07:51
问题 I have an application where the user will be uploading an excel file(.xlsx or .csv) with more than 10,000 rows with a single column "partId" containing the values to look for in database I will be reading the excel values and store it in list object and pass the list as parameter to the Spring Boot JPA repository find method that builds IN clause query internally: // Read excel file stream = new ByteArrayInputStream(file.getBytes()); wb = WorkbookFactory.create(stream); org.apache.poi.ss

Postgresql - IN clause optimization for more than 3000 values

∥☆過路亽.° 提交于 2021-02-17 06:05:04
问题 I have an application where the user will be uploading an excel file(.xlsx or .csv) with more than 10,000 rows with a single column "partId" containing the values to look for in database I will be reading the excel values and store it in list object and pass the list as parameter to the Spring Boot JPA repository find method that builds IN clause query internally: // Read excel file stream = new ByteArrayInputStream(file.getBytes()); wb = WorkbookFactory.create(stream); org.apache.poi.ss

Postgresql - IN clause optimization for more than 3000 values

江枫思渺然 提交于 2021-02-17 06:04:28
问题 I have an application where the user will be uploading an excel file(.xlsx or .csv) with more than 10,000 rows with a single column "partId" containing the values to look for in database I will be reading the excel values and store it in list object and pass the list as parameter to the Spring Boot JPA repository find method that builds IN clause query internally: // Read excel file stream = new ByteArrayInputStream(file.getBytes()); wb = WorkbookFactory.create(stream); org.apache.poi.ss

How to map sql native query result into DTO in spring jpa repository?

穿精又带淫゛_ 提交于 2021-02-17 04:46:33
问题 Hi what I am trying to achieve is to get SQL native query result map into my DTO in java spring jpa repository, how do I do this properly? I try several code, but it does not work, here is what I tried: First try : @Repository public interface StockRepository extends RevisionRepository<Stock, Long, Integer>, JpaRepository<Stock, Long> { @Query(value = "SELECT stock_akhir.product_id AS productId, stock_akhir.product_code AS productCode, SUM(stock_akhir.qty) as stockAkhir " + "FROM book_stock

Create spring repository without entity

限于喜欢 提交于 2021-02-16 15:47:14
问题 I want to use spring data repository interface to execute native queries - I think this way is the simplest because of low complexity. But when extending interface ex. CrudRepository<T, ID> I need to write T - my entity, which is not available. My native queries does not return any concrete entity, so what is the best way to create spring repository without entity? 回答1: CrudRepository or JpaRepository were not designed to work without an <Entity,ID> pair. You are better off creating a custom

Timestamp converter not working in Spring Data Rest with Spanner

て烟熏妆下的殇ゞ 提交于 2021-02-11 18:18:37
问题 I'm trying to convert the input timestamp which will be in the string format to cloud timestamp with the help of a Spring Data Rest custom converter which is not working. Need an help on the same in understanding why custom converters are not invoked. Input: http://localhost:8080/apipromocentral/promotions RequestBody : {"startDateTime": "2019-11-07 15:53:00"} POJO: @ApiModel @Data @AllArgsConstructor @Table(name = "PROMOTIONS") public class Promotion { /** * promotion id */ @ApiModelProperty

Timestamp converter not working in Spring Data Rest with Spanner

空扰寡人 提交于 2021-02-11 18:17:06
问题 I'm trying to convert the input timestamp which will be in the string format to cloud timestamp with the help of a Spring Data Rest custom converter which is not working. Need an help on the same in understanding why custom converters are not invoked. Input: http://localhost:8080/apipromocentral/promotions RequestBody : {"startDateTime": "2019-11-07 15:53:00"} POJO: @ApiModel @Data @AllArgsConstructor @Table(name = "PROMOTIONS") public class Promotion { /** * promotion id */ @ApiModelProperty

Two Modules exports the same package (Spring)

佐手、 提交于 2021-02-11 15:48:34
问题 I get this error when I try run my project. After many hours of search I found out why this happens, but I have no idea how to exclude one from exporting the package. java.lang.module.ResolutionException: Modules spring.aop and aopalliance export package org.aopalliance.intercept to module spring.beans It is my first time with Spring in general (I need JPA for CRUD I'm working now with Hibernate). I used Intellij IDEA's "Add Framework..." function in order to add Spring Data JPA. My Maven pom

Two Modules exports the same package (Spring)

倖福魔咒の 提交于 2021-02-11 15:46:43
问题 I get this error when I try run my project. After many hours of search I found out why this happens, but I have no idea how to exclude one from exporting the package. java.lang.module.ResolutionException: Modules spring.aop and aopalliance export package org.aopalliance.intercept to module spring.beans It is my first time with Spring in general (I need JPA for CRUD I'm working now with Hibernate). I used Intellij IDEA's "Add Framework..." function in order to add Spring Data JPA. My Maven pom