This repo is contains simple example to help reproduce spring-data-jpa SpEL issue in @Query.countQuery
in file app/src/main/java/daggerok/domain/MyEntityRepository.java:
// ...
@Query(
value = " select me.name from #{#entityName} me ",
countQuery = " select count(me.id) from #{#entityName} me "
)
Page<String> findAllNames(final Pageable pageable);
// ...
...
Caused by: java.lang.IllegalArgumentException: org.hibernate.QueryException: unexpected char: '#' [ select count(me.id) from #{#entityName} me ]
...
Caused by: org.hibernate.QueryException: unexpected char: '#' [ select count(me.id) from #{#entityName} me ]
...
bash gradlew bootRun # installed docker and compose are required
curl -sS localhost:8080 | jq
curl -sS localhost:8080/names | jq
bash gradlew stop
bash gradlew --stop