Skip to content

DAO Factory pattern #1270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
iluwatar opened this issue Jul 7, 2020 · 21 comments · May be fixed by #3275
Open

DAO Factory pattern #1270

iluwatar opened this issue Jul 7, 2020 · 21 comments · May be fixed by #3275

Comments

@iluwatar
Copy link
Owner

iluwatar commented Jul 7, 2020

Description:
The DAO (Data Access Object) Factory design pattern is used to abstract and encapsulate all access to the data source, providing a clean separation between the business logic and the data access logic. This pattern enables the application to switch between different data sources and provides a mechanism to manage the data access objects efficiently.

Main elements of the pattern:

  • DAO Interface: Defines the standard operations to be performed on a model object(s).
  • Concrete DAO Class: Implements the DAO interface and handles the CRUD operations with the data source.
  • DAO Factory Interface: Provides a way to get the appropriate DAO based on the data source.
  • Concrete DAO Factory Class: Implements the DAO Factory interface and returns instances of the specific DAO.

References:

  1. DAO Factory Design Pattern - Oracle
  2. Java Design Patterns - DAO

Acceptance Criteria:

  1. Implement the DAO interface and at least one concrete DAO class for a model object.
  2. Create a DAO Factory interface and a concrete implementation of the DAO Factory that returns instances of the concrete DAO.
  3. Ensure that the implementation is well-documented and includes unit tests for the DAO methods and factory.
@ilhan-mstf
Copy link

Hi, I would like to work on this issue. Can you assign it to me?

@iluwatar
Copy link
Owner Author

iluwatar commented Nov 7, 2020

Ok @ilhan-mstf

@NatalieSty
Copy link

@ilhan-mstf are you still working on this issue? Thanks.

@ilhan-mstf
Copy link

ilhan-mstf commented Oct 15, 2021

not actually, sorry

@ilhan-mstf ilhan-mstf removed their assignment Oct 15, 2021
@NatalieSty
Copy link

@iluwatar I'd like to work on this issue, can you assign it to me? Thanks!

@iluwatar
Copy link
Owner Author

Ok @NatalieSty

@AlexTamulaitis
Copy link

Which databases should this factory support? Just the ones listed in the document, or others like mySQL or MSSQL?

@NatalieSty
Copy link

@iluwatar I am working on it with AlexTamulaitis. Can you advise which database should this factory support? Thanks!!

@iluwatar
Copy link
Owner Author

Let's say we need 3 different storages: relational database (e.g. HyperSQL in-memory database), document database (e.g. Mongo), and flat file. @NatalieSty

@NatalieSty
Copy link

@iluwatar we are almost done implementing using mySQL and Derby. Can we support two relational database and one document database?

@iluwatar
Copy link
Owner Author

Yeah, it's a good start

@NatalieSty
Copy link

@iluwatar We went into some hiccups with mySQL; it seems like mysql is no longer supported by SonarQube, and it would be the same for the cloud version. even if it still supports it, it might require the you to install it and create a sonar user with permissions: https://docs.sonarqube.org/7.4/setup/install-server/.

Is derby DB enough for demonstrating this Factory supports relational database? Can we fulfill this issue requirement with just supporting Derby and Mongo?

@iluwatar
Copy link
Owner Author

Yes, it's good enough for now @NatalieSty

@NatalieSty
Copy link

@iluwatar Do you want us to include the mySQL code in the pull request and raise another issue to try to get it to run on Sonar? We can comment it out to avoid errors.

@iluwatar
Copy link
Owner Author

I'm not sure that I understand the issue you are having with MySQL and SonarQube. Are you trying to install SonarQube for yourself to scan the code?

@rrreynaldo
Copy link

Hi @iluwatar, I am interested and would like to give this issue a try. Can you assign it to me? Thanks!

@iluwatar
Copy link
Owner Author

iluwatar commented Oct 8, 2022

Ok @rrreynaldo

@stale
Copy link

stale bot commented Nov 28, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status: stale issues and pull requests that have not had recent interaction label Nov 28, 2022
@stale stale bot removed the status: stale issues and pull requests that have not had recent interaction label Dec 1, 2022
@iluwatar iluwatar moved this from In Progress to Todo in Java Design Patterns project Dec 1, 2022
@iluwatar iluwatar added info: help wanted status: stale issues and pull requests that have not had recent interaction labels Dec 1, 2022
@stale stale bot removed the status: stale issues and pull requests that have not had recent interaction label Dec 1, 2022
Copy link

github-actions bot commented Jan 9, 2025

This issue is stale because it has been open 60 days with no activity.

@github-actions github-actions bot added the Stale label Jan 9, 2025
@iluwatar iluwatar removed the Stale label Jan 12, 2025
@letdtcode
Copy link

Could you assign this issue to me? I'd like to resolve it

@letdtcode
Copy link

@iluwatar I've completed the implementation and am now writing unit tests. Could you let me know what the target code coverage percentage should be for this project ?

@letdtcode letdtcode linked a pull request May 4, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment