Announcement Announcement Module
Collapse
No announcement yet.
SimpleJdbcTemplate query gets 0 rows, but pasting query into SQL browser gets > 0 row Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SimpleJdbcTemplate query gets 0 rows, but pasting query into SQL browser gets > 0 row

    I have a DAO class that I wrote. It has some existing queries that I wrote that I can step through, and which are returning rows. Someone else added a query to this class which I unfortunately have to debug. When I step through the call for the new query, it's returning zero rows. However, when I paste the resulting query string into my SQL browser, connected to the same database, it returns rows. The new query doesn't have any prepared statement parameters, so I can paste it directly into my SQL browser without changes. I took the query string in two different ways, one copying the value from Eclipse, one copying it from the SQL log output. Same result (gets rows in my SQL browser).

    I set a breakpoint in the RowMapper's "mapRow()" method, but it doesn't get there (not terribly surprising).

    I'm just using the basic "getSimpleJdbcTemplate().query(query, new MyRowMapper())" strategy.

    The query is somewhat long, and I'd rather not paste it here. Remember that I'm not getting any errors, it's just not returning any rows in the code, but when I paste that resulting query into my SQL browser, it's returning rows.

    What sorts of things could be going wrong here?
Working...
X