Announcement Announcement Module
No announcement yet.
IncorrectResultSizeDataAccessException? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • IncorrectResultSizeDataAccessException?

    I have a DAO that needs to query a table for a row which may or may not be there. I was attempting to use the JdbcTemplate.queryForObject, returning the String of the column I selected. After looking at the JavaDoc, my intent was to catch the IncorrectResultSizeDataAccessException, whose javadoc states:

    Data access exception thrown when a result was not of the expected size, for example when expecting a single row but getting 0 or more than 1 rows.
    The thing is, I can't find this class anywhere in the jars I have, and when running the method, I get the superclass InvalidDataAccessApiUsageException. I'm hesitant to assume no records were found on this exception since the javadoc seems to indicate the problem may not be that specific.

    If there is a cleaner way to get the same results, please let me know.


  • #2
    It has been there since 1.0.2 - full name is:
    org.springframework.dao.IncorrectResultSizeDataAcc essException
    and it does extend the InvalidDataAccessApiUsageException


    • #3
      Oops. I was wrong on the version of Spring I am using. I'm on 1.0.1. Thanks.