Announcement Announcement Module
Collapse
No announcement yet.
Spring Exception Handling Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Exception Handling

    I am using the following method to update and delete the datas in a table which has primary and foriegn key constraints.Actually I am providing struts interface for entering the values in the table and in action class I will insert the values calling this method.

    public List doSelectAsMap(String query) {
    jt = new JdbcTemplate(datasource);
    List result=jt.queryForList(query);
    return result;
    }
    Now If dulicate records are inserted or if primary key used in other tables are deleted ,I am getting exceptions.How can I handle these exception and give meaningful message to the user.

  • #2
    Hi,

    I don't think queryForList is the apt method in this case,since you are either inserting or updating the data in the database.

    You can configure exceptionResolver in spring.Then you will have to create exception pages and register them in spring.Refer the spring api for how to configure exception resolver.

    Regards,
    harry

    Comment


    • #3
      Why not use the supportDao class as a super?

      Comment

      Working...
      X