Results 1 to 3 of 3

Thread: Catching Hibernate Exception

  1. #1
    Join Date
    Sep 2004
    Location
    Tokyo, Japan
    Posts
    22

    Default Catching Hibernate Exception

    Hi,

    I am using Hibernate for Database Access. I have a single controller for doing both 'add' and 'edit' to database and the controller extends SimpleFormController. To place a command object in session i used controller's formBackingObject() method. In that method i tried to retrieve an object from database by the object_ID to put it to the command object. But if there is no object found for that given object_ID then an exception occur. I become able to catch the exception but cannot showing the error in a specified view page.

    How can i show that error in my specified page.

    Mamun

  2. #2
    Join Date
    Aug 2004
    Location
    Amsterdam, Netherlands
    Posts
    450

    Default

    Just rethrow the error (or convert it to something more sensible) and attach a so-called HandlerExceptionResolver. There's more info on those thingies in the docs, section 12.9

    cheers,
    Alef

  3. #3
    Join Date
    Sep 2004
    Location
    Tokyo, Japan
    Posts
    22

    Default

    Its very cool and nice solution.
    Thanks Alef.............

    Mamun

Similar Threads

  1. Context initialization failed
    By kanonmicke in forum Container
    Replies: 7
    Last Post: Sep 29th, 2005, 12:35 AM
  2. Replies: 2
    Last Post: Aug 31st, 2005, 12:37 PM
  3. Odd behaviour when injecting TransactionTemplate
    By damon311 in forum Container
    Replies: 3
    Last Post: Jul 23rd, 2005, 11:21 AM
  4. Replies: 0
    Last Post: Jul 11th, 2005, 05:49 PM
  5. Replies: 3
    Last Post: Nov 8th, 2004, 07:30 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
  •