Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6367549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:33:44+00:00 2026-05-25T00:33:44+00:00

I am using spring and Hibernate in my application,There is one scenario where i

  • 0

I am using spring and Hibernate in my application,There is one scenario where i insert same records morethan once ,So application correctly throwing Constraint Exception because i applied Unique constraint in one of the db column.So far is everything fine.

But i have to display some custom message like “record already exists'” instead of showing Hibernate Exception.

How can i do with Spring framework.

Any hints or examples greatly appreciated.

Regards,

Raju

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:33:45+00:00Added an answer on May 25, 2026 at 12:33 am

    Yes you can exception in controller:

      @ExceptionHandler(Exception.class)
          public ModelAndView handleMyException(Exception  exception) {
             ModelAndView mv = new ModelAndView("error");
             mv.addObject("message"."record already exists");
             return mv;
                  } 
    

    Of cause you can catch any tpe of exception just insert it as the parameter to @ExceptionHandler

    Hope it helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are developing a web application using Spring framework and Hibernate ORM. As far
I am working on an application using Spring 3 and Hibernate 3.5 with Java
I am using Spring 3, JPA + Hibernate for a CMS application. In that
I'm doing a Web application using Spring 3.1.0.RELEASE, JSF 2.x, JPA 2 with Hibernate
I have an extremely simple web application running in Tomcat using Spring 3.0.2, Hibernate
I am developing a Java Web Application using JSF, Spring and Hibernate. I need
I am using hibernate, spring, struts framework for my application. In my application, each
I am using Spring with Hibernate in my project.There are many methods written in
I have an application using Hibernate for data persistence, with Spring on top (for
I'm interested in porting an existing application which was written using Spring/Struts2/Hibernate to GAE.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.