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 7044951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:28:15+00:00 2026-05-28T02:28:15+00:00

I have written my DAO layer and service layer for my database using Spring.

  • 0

I have written my DAO layer and service layer for my database using Spring.

In some of the tables we have unique constraints for some columns. If we try to insert the duplicate values for those columns, how do we catch those exceptions specifically based on the column name? Basically I need to know which column caused the query failure.

  • 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-28T02:28:15+00:00Added an answer on May 28, 2026 at 2:28 am

    DAO operations which violate a unique key will throw a DataIntegrityViolationException. However, you won’t easily be able to extract the specific column name from this, it’s just not that detailed.

    If you need this information, you should consider querying the database before you run the insert/update, checking that the constraint won’t be violated. If that check fails, then you have your information.

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

Sidebar

Related Questions

We're using Grails but with an existing model layer and DAO layer. We have
I have written some code in my VB.NET application to send an HTML e-mail
I have written a code for downloading a file(blob in database table).I get a
Have written some RoR sites in the past, but never bothered too much at
I have written a scrapy spider to scrape out some html tags. Now the
I have written a xml/php document that is pulling from a Magento Commerce database,
I have written a Windows Forms application and now I want to write some
I have written a gateway to get a result set from my database. How
Have written a method; when I try to run it, I get the error:
I have written a app in PHP on my localhost server using XAMP, which

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.