Subset returned by queryForList is incorrect,but executed in SQL Developer it's OK
Subset returned in DAO class:
List<Map<String, Object>> agreements = getJdbcTemplate().queryForList(sqlForDataQuery.toString(), paramsForList.toArray());
It expected to be sorted,but in debug mode application returns incorrect subset - it's not sorted.
From other hand,if to execute sqlForDataQuery
with all paramsForList
in Oracle Sql Developer, that expected sorted correct subset returned.
sqlForDataQuery
runtime value:
SELECT * FROM (SELECT t1.*, ROWNUM rn FROM (SELECT /*+ CHOOSE */ DISTINCT a.avtalenavn, a.kunde_id, a.aktivdato, a.bank_id, a.avtalestatus_id, a.produkt_id, a.avtale_id, p.navn, k.foretaksnr, k.navn AS KUNDENAVN FROM es.avtale a, es.avtale_konto ak, es.kunde k, es.produkt p WHERE a.bank_id = ? AND ak.avtale_id = a.avtale_id AND a.kunde_id = k.kunde_id AND UPPER(a.avtalenavn) LIKE UPPER(('%' || ? || '%')) AND a.produkt_i开发者_如何学编程d = p.produkt_id ORDER BY ? ) t1 ) WHERE rn BETWEEN ? AND ?
paramsForList
runtime value:
4210, a, AVTALE_ID, 1, 5
Looks like query executed not correctly,but no Exception thrown.
Have you any idea of problem scope?
Thank you.
Take a look at this
Short story: you can't use parameters as columns for ordering in a PreparedStatement and jdbcTemplate uses prepared statements under the hood.
精彩评论