Results 1 to 2 of 2

Thread: DataRetrievalFailureException versus IncorrectResultSizeD...

  1. #1
    Join Date
    Oct 2004
    Posts
    1

    Default DataRetrievalFailureException versus IncorrectResultSizeD...

    What is Spring's philosophy on throwing IncorrectResultSizeDataAccessException versus DataRetrievalFailureException. I ran JdbcTemplate's queryForInt() when the expected row was not found. The implementation throws IncorrectResultSizeDataAccessException when I was expecting DataRetrievalFailureException. Under what circumstances is DataRetrievalFailureException (or subclasses) thrown?

    Thanks,
    Jon

  2. #2
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    DataRetrievalFailureException will always be mapped to by things like the Hibernate error code mapper, the JDO mapper, etc., when you query for a particular object and that entity is not around. It's entirely appropriate for your DAO to throw it as well when something it's trying to load is not there (which should be).

    On the other hand, I would consider IncorrectResultSizeDataAccessException a lower level exception. It's thrown by the JDBC code when there are simply not enough rows of data, _or_ there are too many rows of data...

    I agree there is some overlap.

Similar Threads

  1. Spring MVC Web Framework versus Struts
    By biguniverse in forum Web Flow
    Replies: 27
    Last Post: Aug 29th, 2012, 03:57 AM
  2. Sitemesh versus Tiles (use with Spring MVC)
    By biguniverse in forum Web
    Replies: 2
    Last Post: Jul 27th, 2005, 07:49 PM
  3. Replies: 4
    Last Post: Jul 20th, 2005, 11:30 AM
  4. tiles versus velocity or freemarker
    By lumpynose in forum Architecture
    Replies: 1
    Last Post: May 27th, 2005, 05:32 AM
  5. TransactionStatus versus DefaultTransactionStatus
    By steven.warren in forum Data
    Replies: 0
    Last Post: Mar 29th, 2005, 12:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •