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
@Query("SELECT id FROM Person")
Page<Long> findIdsPageable(Pageable pageable);
I get always only one page of data and I can see this in the log:
Hibernate: select p1_0.ID from Person p1_0 fetch first ? rows only
Hibernate: select count(null) from Person p1_0
2025-01-13 22:59:44,762 (main) WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] SQL Warning Code: -1003, SQLState: 01003
2025-01-13 22:59:44,763 (main) WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] warning: null value eliminated in set function
When using previous version of spring-data-jpa (3.3.7), I can see correct count(...) query and paging is working correctly:
Hibernate: select p1_0.ID from Person p1_0 fetch first ? rows only
Hibernate: select count(p1_0.ID) from Person p1_0
Is there something I should do differently to fix this issue?
The text was updated successfully, but these errors were encountered:
For the time being, please update your query by adding an alias to the FROM Person clause updating it to SELECT p.id FROM Person p. While your query meets the HQL spec, it isn't compatible with JPQL, which requires aliases for entity names.
mp911de
changed the title
count(null) in pageable query with explicit SELECT column since 3.4.0+
SELECT HQL without entity alias results in SELECT COUNT(null) query
Jan 14, 2025
When writing e.g. this query:
I get always only one page of data and I can see this in the log:
When using previous version of spring-data-jpa (3.3.7), I can see correct count(...) query and paging is working correctly:
Is there something I should do differently to fix this issue?
The text was updated successfully, but these errors were encountered: