Closed
Description
Hi
We upgraded our project to Spring Data JPA 3.1 and found new error. We have StoryRepository with method findStories:
@Query("FROM Story WHERE enabled = true")
List<Story> findStories(Pageable pageRequest);
And we invoke it in our service:
Pageable pageable = limit > 0 ? PageRequest.of(0, limit)
: PageRequest.of(0, Integer.MAX_VALUE, Sort.by(Direction.DESC, "created"));
return storyRepository.findStories(pageable);
It worked before upgrade but now we got an exception:
Caused by: org.hibernate.query.sqm.ParsingException: line 1:45 mismatched input '.' expecting {<EOF>, ',', '+', '-', '*', '/', '%', '||', ASC, BY, DAY, DESC, EPOCH, FETCH, HOUR, LIMIT, MINUTE, MONTH, NANOSECOND, NULLS, OFFSET, QUARTER, SECOND, WEEK, YEAR}
Here's JPQL query generated by Spring Data:
FROM Story WHERE enabled = true order by null.created desc
Interesting is that if we change our repository query to
@Query("SELECT p FROM Story p WHERE p.enabled = true")
then everything works correctly.