Skip to content Skip to sidebar Skip to footer

How To Specify An `order By` On Ambiguous Column Using Spring Batch And Postgres?

I'm extending a JdbcPagingItemReader to do a query that sorts by a column, but it is not working, it seems spring batch and postgres create incompatible constraints. In essence, th

Solution 1:

The solution I took was to use JdbcCursorItemReader instead of JdbcPagingItemReader, which solves my problem but does not answer if JdbcPagingItemReader is meant to (not) work in this use case.

The changes I made to our code is here.

Solution 2:

We ran into this issue, if you alias the fully qualified column name in your select it will work. Your analysis is correct, and if you do select ta.my_id as "ta.my_id" then the value you need gets returned in the result set and the same sort key can be referenced in where and order by clauses.

Post a Comment for "How To Specify An `order By` On Ambiguous Column Using Spring Batch And Postgres?"