spring-bootspring-data-jpatomcat10

After upgrade how can troubleshoot JPA for spring 3?


I've just upgraded to spring 3 with JPA and getting those kind of errors:

Validation failed for query for method public abstract org.springframework.data.domain.Page com.z.repository.XXX.find(org.springframework.data.domain.Pageable,java.util.Set,java.lang.String,java.math.BigDecimal)

@Query("SELECT t FROM XXX t " +
            "join t.fun " +
            "join t.stu " +
            "left join t.VVV " +
            "left join t.Y " +
            "join t.TSA where t.VOI.size = 0 and t.TSA.sta in (:statuses) " +
            "and (t.timId = :timId  " +
            "or lower(t.fun.code) like lower(:search) " +
            "or lower(t.num) like lower(:search) " +
            "or lower(t.stu.men.nam) like lower(:search) " +
            "or lower(t.stu.men.fna) like lower(:search) " +
            "or t.VVV.min like :search " +
            "or t.stu.ema like :search " +
            "or lower(t.stu.naù) like lower(:search)) " +
            "")
    Page<XXX> find(Pageable pageable, @Param("statuses") Set<String> statuses, @Param("search") String search, @Param("timId") BigDecimal timId);

Any idea how I can troubleshoot to understand what's wrong?


Solution

  • Not clear why but

    @Query(nativeQuery = true, value = "SELECT t FROM XXX t " +

    is doing the trick.