Skip to content

Latest commit

 

History

History

spel

spring-data-spel-example Build Status

This repo is contains simple example to help reproduce spring-data-jpa SpEL issue in @Query.countQuery

how to reproduce issue

update custom 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);
  // ...

verify bootstrapping fail with exception

...
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 ]
	...

run app

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