📘 Premium Read: Access my best content on Medium member-only articles — deep dives into Java, Spring Boot, Microservices, backend architecture, interview preparation, career advice, and industry-standard best practices.
✅ Some premium posts are free to read — no account needed. Follow me on Medium to stay updated and support my writing.
🎓 Top 10 Udemy Courses (Huge Discount): Explore My Udemy Courses — Learn through real-time, project-based development.
▶️ Subscribe to My YouTube Channel (172K+ subscribers): Java Guides on YouTube
Check out DAO pattern at https://www.javaguides.net/2018/08/data-access-object-pattern-in-java.html
Persistence Operations (CRUD Operations)
These are the commonly used database table operations for every table so we can make these operations generic in the DAO layer.- Inserting data
- Updating data
- Deleting data
- Retrieving data
Different Options to Develop Persistence or DAO Layer
In the Java community, we have different options to develop Persistence/DAO layer- Java JDBC
- Spring JDBC
- ORM Frameworks ( Hibernate, MyBatis etc)
- Spring Data ( Spring Data JPA, Spring Data MongoDB, Spring Data REST, Spring Data Elasticsearch etc)
Spring MVC Three Layer Architecture
The above diagram shows a 3 layer architecture in any typical Spring MVC web applications.Presentation layer: This is the user interface of the application that presents the application’s features and data to the user.
Business logic (or Application) layer: This layer contains the business logic that drives the application’s core functionalities. Like making decisions, calculations, evaluations, and processing the data passing between the other two layers.
Data access layer (or Data) layer: This layer is responsible for interacting with databases to save and restore application data.
Best Practice to Develop Persistence or DAO Layer
For example:
USER -> UserDao.java
CUSTOMER -> CustomerDao.java
ROLES -> RolesDao.java
ACCOUNT_DETAILS -> AccountDetailsDao.java
USER -> UserDao.java
UserDaoImpl.java
CUSTOMER -> CustomerDao.java
CustomerDaoImpl.java
ROLES -> RolesDao.java
RolesDaoImpl.java
ACCOUNT_DETAILS -> AccountDetailsDao.java
AccountDetailsDaoImpl.java
3. At least one primary key per table
4. Auditing columns:
-> CREATED_DATE
-> CREATED_BY
-> UPDATED_DATE
-> UPDATE_BY
Comments
Post a Comment
Leave Comment