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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:49:59+00:00 2026-05-24T21:49:59+00:00

I have to design a DAO that makes a call to a REST WS.

  • 0

I have to design a DAO that makes a call to a REST WS.
This WS must return the user Credentials from the given username and password.

Case 1 : the user was found => the REST WS sends http code 200 and a credentials response.

Case 2 : the user was not found => the REST WS sends http code 400 and an error object with the cause.

Case 3 : the user was found but his account is disabled => the REST WS sends http code 400 and and error object with the cause.

Case 4 : the REST WS is not available

What is the best way in my DAO to map the REST WS response ?

1 – I throw funtionnal checked exceptions in my DAO to treat the error objects cases and i return credentials response objects in normal cases. When REST WS is unavailable, i throw an unchecked exception

2 – I don’t throw any functionnal exception in my DAO, as it is the Service layer’s job. I return what the REST WS is returning, ie credentials responses and error responses in a wrapped object for example and i let the Service layer check for these objects to do the right job. When REST WS is unavailable, i throw an unchecked exception

3 – I only throw unchecked exceptions for error cases and i let the service layer decide what to do with it. And i return only Credentials response.

Thank you very much in advance.

  • 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-24T21:50:00+00:00Added an answer on May 24, 2026 at 9:50 pm

    I prefer option 1 because your DAO is taking responsibility for understanding what the remote datasource is returning. Your service layer sits above your DAO and should not have to understand any intricacies of the remote source; this includes how errors are returned over the wire.

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

Sidebar

Related Questions

We have implemented a typical DAO/Abstract Factory pattern. The design is like this: DAOFactory
i have design similar to below given link. when i open this link and
We have a design we need to implement where the concept is the user
I have a design for a page that uses 3 types of audio and
I have to design a data structure that is to be used in a
I have this design which I cannot seem to get right, I would like
i have design an layout in that i have to place admob in bottom
Background: I have a design pattern problem that I was hoping someone may be
I have a domain object that stores some metadata and some raw bytes. This
I have a design question about the use of Hibernate annotations and DAO pattern.

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.