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

  • SEARCH
  • Home
  • 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 8239557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:11:14+00:00 2026-06-07T20:11:14+00:00

I am using Spring ROO. In my web application I can create many users

  • 0

I am using Spring ROO.
In my web application I can create many users and save.
I can update the existing users as well.

For the update scenario we are using merge() method to update the existing data. In database, the column ‘username’ is unique. Following is the scenario.

  1. The user create an user name ‘Sean’ with mobile number ‘6039274849’

  2. The user create another user named ‘Parker’ with mobile number ‘8094563454’

  3. When the user tries to update the second user ‘Parker’ with ‘Sean’, I am getting exception.

In the stacktrace I could see the following exception being the causes

  1. caused by ConstraintviolationException
  2. caused by SQLException
  3. caused by TransactionSystemException
  4. caused by PersistenceException
  5. caused by TransactionRollbackException

I tried the do the following

public String merge()
  {
     try{
          //code to merge
        }
     catch(????? e){
         throw e;
     }
  }

I tried to add the above 5 exceptions in ‘????’ . But I couldnot catch still.

Can anyone please tell which exception I need to add in ‘????’ to catch the exception from the above list?

P.S: I am using Spring ROO. So I am changing code in .aj file. Please dont close this question as duplicate. I am expecting an answer from anyone for my issue before closing this question.

  • 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-06-07T20:11:17+00:00Added an answer on June 7, 2026 at 8:11 pm

    Um, aren’t you just rethrowing the exception in your catch? It should be the “most-recent” exception in the trace, so ConstraintValidationException.

    Note that typically in Spring/Hibernate apps, the exception bubbling out of your code is what causes transactions to roll back. If you catch the exception, you will probably prevent that, which might lead to data inconsistencies.

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

Sidebar

Related Questions

Can anyone direct me how to create a many-to-many relationship using the spring roo
I am using Spring-ROO as well as Spring security for my web application. I
In my web application I am using JSPX (Spring ROO). I need to add
I've set up a CRUD web application with Spring Roo and Spring MVC. My
I am using spring roo with mongodb. I would like to create an entity
In my web application (my first with Java, Spring, OR Roo), I'm building a
I'm using Spring (Roo specifically) to develop an application and for one entity I
Hi I am using Spring Roo to create a service to access the data
I have Roo-generated Spring MVC application connected to PostgreSQL using Hibernate. I am trying
I'm using Spring/Roo for an app server, and need to be able to post

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.