Skip to content

paulbakker/spring-data-jpa-sort-bug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project reproduces a bug with using #sort in a native query with spring-data-jpa.

The @Repository is defined in ShowsRepository, which has a native query. The native query is written as select * from show #sort, and the method has a Sort parameter.

Without the SortFixQueryRewriter, the example test (SpringDataBugsApplicationTests) fails because of the incorrect query

select * from show #sort order by title asc

Note that it almost did the right thing; it appended order by title asc. However, it failed to remove the #sort placeholder.

The SortFixQueryRewriter works around the problem, but obviously shouldn't be needed.

The SpringDataBugsApplicationTests uses a Postgres Testcontaier, no setup is required.

About

Example project to reproduce spring-data-jpa #sort bug with native queries

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages