JPA native query get different result than executed directly on DB

37 Views Asked by At

I have this query in my jpa repository

@Query(value = """
        SELECT DISTINCT a.*
        FROM V_APP_STORICO_STATI a
        WHERE a.ID_RAGGR_ACCRED = :idRaggr AND
        lower(a.cod_stato) <> lower(:cos) AND
        a.storicizzato = 1
        ORDER BY a.data_stato desc
        """, nativeQuery = true)
List<VistaPerStoricoAccreditamenti> findByIdRaggrAccredAndStoricizzato(@Param("idRaggr") Long idRaggr, @Param("cos") String cos);

if i execute the query directly on the DB i get this result

enter image description here

if the query is executed by jpa repository i get different values

enter image description here

the fifth element value is different. What is the problem? why jpa is unable to get correct results?

0

There are 0 best solutions below