java-design-patterns
java-design-patterns copied to clipboard
DAO Factory pattern
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:
Acceptance Criteria:
- Implement the DAO interface and at least one concrete DAO class for a model object.
- Create a DAO Factory interface and a concrete implementation of the DAO Factory that returns instances of the concrete DAO.
- Ensure that the implementation is well-documented and includes unit tests for the DAO methods and factory.
Hi, I would like to work on this issue. Can you assign it to me?
Ok @ilhan-mstf
@ilhan-mstf are you still working on this issue? Thanks.
not actually, sorry
@iluwatar I'd like to work on this issue, can you assign it to me? Thanks!
Ok @NatalieSty
Which databases should this factory support? Just the ones listed in the document, or others like mySQL or MSSQL?
@iluwatar I am working on it with AlexTamulaitis. Can you advise which database should this factory support? Thanks!!
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
@iluwatar we are almost done implementing using mySQL and Derby. Can we support two relational database and one document database?
Yeah, it's a good start
@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?
Yes, it's good enough for now @NatalieSty
@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.
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?
Hi @iluwatar, I am interested and would like to give this issue a try. Can you assign it to me? Thanks!
Ok @rrreynaldo
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.