postgresql - 在 SpringBoot JPA 中使用 Postgres 本机查询不起作用
问题描述
我正在select * from device_analytics where extract(year from comm_mnth) = 2021 and extract(month from comm_mnth) = 8 and comm_type = 'DEVICE'
sql 编辑器中尝试此查询,它按预期返回数据。但是,当我使用本机查询通过 JPA 尝试相同的查询时,它返回 null,JPA 查询中有什么问题。
@Query(value = "select * from device_analytics where extract(year from comm_mnth) =:year and extract(month from comm_mnth) =:month and comm_type =:commType", nativeQuery = true)
DeviceAnalyticsEntity findDeviceAnlayticsEntity(@Param("month") int month, @Param("year") int year,
@Param("commType") String commType);
// 这会返回 null
analyticsRepoRo.findDeviceAnlayticsEntity(9, 2021,"DEVICE");
TIA
解决方案
推荐阅读
- javascript - Chartjs:使用 chartjs-plugin-datalabels 在较小的数据集中重叠数据标签
- python - OSError: [WinError 193] %1 在 python 中不是有效的 Win32 应用程序
- android - 从 searchView onClick 开始 Fragment
- pandas - Dataframe groupby 产生一个组两次
- vue.js - Nuxtjs Axios onRequest() 未针对 asnycData 请求执行
- amazon-web-services - 无法访问 S3 存储桶内容:访问被拒绝
- javascript - React Javascript中高阶函数中的两个箭头是什么
- sml - SML 列表 [1, 2, 3,...n]
- go - 为什么不只是在方法 header.clone 中为目标赋值
- flutter - flutter facebook广告如何展示?