JPA 和 Sysdate 问题 - 强制接受 Double 数据类型
JPA and Sysdate issue - forcefully accepting Double data types
我正在使用 Spring Data JPA 并开发了以下查询,该查询将动态获取日值并获取数据,但看起来它在寻找 Double 数据类型方面存在争议。为什么要加倍?
@Query("SELECT new com.XXX.SomeDTODto(p.visitDate, ..........) "
+ "FROM PatientData p "
+ "INNER JOIN ................. "
+ "INNER JOIN ................."
+ "INNER JOIN .................. "
+ "INNER ..... "
+ "WHERE (TRUNC (p.visitDate) >= TRUNC (SYSDATE + :startDay) AND TRUNC (p.visitDate) <= TRUNC (SYSDATE + :endDay))")
Page<SomeDTODto> findByvisitDateBetweenDays(@Param("startDay") Double startDay,
@Param("endDay") Double endDay, Pageable pageable);
我在下面,功能测试用例针对 H2 DB 运行并失败
here TRUNC(patient0_.patient_dt)>=TRUNC(SYSDATE+?) and TRUNC(patient0_.patient_dt)<=TRUNC(SYSDATE+?) order by patient0_.patient_dt asc limit ? [50004-196]
你可以在下面使用,这对我来说很好,而且 Integer 正在转换为 Double
"WHERE (TRUNC (p.visitDate) >= TRUNC (SYSDATE + CAST(:startDay AS double) + 0) AND TRUNC (p.visitDate) <= TRUNC (SYSDATE + CAST(:endDay AS double) + 0))")
我正在使用 Spring Data JPA 并开发了以下查询,该查询将动态获取日值并获取数据,但看起来它在寻找 Double 数据类型方面存在争议。为什么要加倍?
@Query("SELECT new com.XXX.SomeDTODto(p.visitDate, ..........) "
+ "FROM PatientData p "
+ "INNER JOIN ................. "
+ "INNER JOIN ................."
+ "INNER JOIN .................. "
+ "INNER ..... "
+ "WHERE (TRUNC (p.visitDate) >= TRUNC (SYSDATE + :startDay) AND TRUNC (p.visitDate) <= TRUNC (SYSDATE + :endDay))")
Page<SomeDTODto> findByvisitDateBetweenDays(@Param("startDay") Double startDay,
@Param("endDay") Double endDay, Pageable pageable);
我在下面,功能测试用例针对 H2 DB 运行并失败
here TRUNC(patient0_.patient_dt)>=TRUNC(SYSDATE+?) and TRUNC(patient0_.patient_dt)<=TRUNC(SYSDATE+?) order by patient0_.patient_dt asc limit ? [50004-196]
你可以在下面使用,这对我来说很好,而且 Integer 正在转换为 Double
"WHERE (TRUNC (p.visitDate) >= TRUNC (SYSDATE + CAST(:startDay AS double) + 0) AND TRUNC (p.visitDate) <= TRUNC (SYSDATE + CAST(:endDay AS double) + 0))")