You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicinterfaceBookErrorRepositoryextendsRepository<BookError, Long> {
@Query("FROM BookError b WHERE portal = :portal AND date >= :startDate AND date <= :endDate" +
" AND (:search IS NULL OR keyword LIKE :search%)" +
" AND (:state IS NULL OR errors = :#{#state?.shortMessage})")
Page<BookError> findByPortalInDateRange(@Param("portal") Portalportal,
@Param("startDate") LocalDatestartDate,
@Param("endDate") LocalDateendDate,
@Param("search") Optional<String> search,
@Param("state") Optional<State> state,
Pageablepageable);
}
When changing this to
FROMBookErrorWHEREportal [...]
the attached exception occurs on startup.
At first it seems like an issue with the HQL parser, but upon further inspection it seems that spring-data-jpa doesn't generate the count query correctly, because it recognizes WHERE as the alias.
In the event of a Hibernate query where there is no explicit alias in the FROM clause, the query parser should be able to fashion a temporary alias and use it for counting.
Resolves#2032.
Part of this query's issue is that the LIKE clause details should be wrapped inside single-quotes. As for the rest, we're working up a solution to handle missing aliases.
In the event of a Hibernate query where the FROM clause has no alias, the query parser should use "__" as a stand-in alias.
Resolvesspring-projects#2032.
Related: spring-projects#2220.
Jonas Tänzer opened DATAJPA-1737 and commented
Consider the following repository:
When changing this to
the attached exception occurs on startup.
At first it seems like an issue with the HQL parser, but upon further inspection it seems that spring-data-jpa doesn't generate the count query correctly, because it recognizes WHERE as the alias.
This isn't a huge issue issue of course, but I figured I'd report to at least receive feedback anyway.
Attachments:
The text was updated successfully, but these errors were encountered: