Postgres native query not working while using in SpringBoot JPA

Viewed 181

I am trying this query select * from device_analytics where extract(year from comm_mnth) = 2021 and extract(month from comm_mnth) = 8 and comm_type = 'DEVICE' in sql editor and it is returning data as expected. But when I trying the same query via JPA using native query its returning null, what is wrong here in JPA query.

@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);

// This returns null

analyticsRepoRo.findDeviceAnlayticsEntity(9, 2021,"DEVICE");

TIA

0 Answers
Related