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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:30:46+00:00 2026-06-04T09:30:46+00:00

I am building an application with Playframework 1.2x I have to detect if a

  • 0

I am building an application with Playframework 1.2x

I have to detect if a database operation succeeded or not while doing CRUD operations

Here is what I have till now

public static void create(Args..) {
        Model m = new Model(Args..);
        m.save();
        if(m.id == null) {
        // Render failure Response
        }else {
        // Render Success Response
        }
}

public static void read(long id) {
        Model m = Model.findById(id);
        if(m == null ) {
            // Render failure Response
        }else{
            // Render Success Response
        }
}

I am not really sure as to what has to be done for UPDATE and DELETE.

The above method is not very elegant . Is there a better solution for this, like Exceptions ?

I tried shutting down the database server that gives me a PersistenceException is this the way to go ? are there more exceptions similar to this ?

  • 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-04T09:30:47+00:00Added an answer on June 4, 2026 at 9:30 am

    Yes if you have a database connection problem you will have some exception that will be thrown by the ORM. PersistenceException is the root of JPA exceptions so if the exception is detected by the ORM you have this kind of exception.

    For me, catching unexpected exceptions is not the way to go. If you have this kind of technical problem, your database will rollback you crud operation and nothing will be save.

    Just catch exception that mean something for the user and let the other ones go up, then play will show a generic 500 page in this case

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

Sidebar

Related Questions

Building an application with a database that has the ability to get big not
Unlike this question: Linker Error while building application using Boost Asio in Visual Studio
I'm building an application and as time goes on, I have more and more
While building my application with relational tables I ran into the following problem :
I have application building using third party apis, j2me apis,application code distributed in various
Started building an application here. client and server style architecture sending active resources across
Building an application to calculate metrics on Service Level Agreements. I have access to
I am beginner in C# programming. I have encountered small problem during building application
I am building an application in .NET (not important what language, it is a
I am building an application in Java. My database ( Cassandra ) understands only

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.