Home kellton

Main navigation

  • Services
    • Digital Business Services
      • AI & ML
        • Agentic AI Platform
        • Utilitarian AI
        • Predictive Analytics
        • Generative AI
        • Machine Learning
        • Data Science
        • RPA
      • Digital Experience
        • Product Strategy & Consulting
        • Product Design
        • Product Management
      • Product Engineering
        • Digital Application Development
        • Mobile Engineering
        • IoT & Wearables Solutions
        • Quality Engineering
      • Data & Analytics
        • Data Consulting
        • Data Engineering
        • Data Migration & Modernization
        • Analytics Services
        • Integration & API
      • Cloud Engineering
        • Cloud Consulting
        • Cloud Migration
        • Cloud Managed Services
        • DevSecOps
      • NextGen Services
        • Blockchain
        • Web3
        • Metaverse
        • Digital Signage Solutions
    • SAP
      • SAP Services
        • S/4HANA Implementations
        • SAP AMS Support
        • SAP Automation
        • SAP Security & GRC
        • SAP Value Added Solutions
        • Other SAP Implementations
      • View All Services
  • Platforms & Products
    • Audit.io
    • AiQ
    • Tasks.io
    • Optima
    • tHRive
    • Kellton4Health
    • Kellton4Commerce
    • KLGAME
    • Our Data Accelerators
      • Digital DataTwin
      • SmartScope
      • DataLift
      • SchemaLift
      • Reconcile360
    • View All Products
  • Industries
    • Fintech, Banking, Financial Services & Insurance
    • Retail, E-Commerce & Distribution
    • Pharma, Healthcare & Life Sciences
    • Non-Profit, Government & Education
    • Travel, Logistics & Hospitality
    • HiTech, SaaS, ISV & Communications
    • Manufacturing
    • Oil,Gas & Mining
    • Energy & Utilities
    • View All Industries
  • Our Partners
  • Insights
    • Blogs
    • Brochures
    • Success Stories
    • News / Announcements
    • Webinars
    • White Papers
  • Careers
    • Life At Kellton
    • Jobs
  • About
    • About Us
    • Our Leadership
    • Testimonials
    • Analyst Recognitions
    • Investors
    • Corporate Sustainability
    • Privacy-Policy
    • Contact Us
    • Our Delivery Centers
      • India Delivery Center
      • Europe Delivery Center
Search
  1. Home
  2. All Insights
  3. Blogs

What is DAO in Java’s Spring Boot?

Product Engineering
June 23 , 2015
Posted By:
Kellton
linkedin
What is DAO in Java’s Spring Boot

Other recent blogs

Next-Gen OTT Experience with Generative AI
Architecting the Next-Gen OTT Experience with Generative AI
July 01 , 2025
ai agent workflow
What Are Agentic AI Workflows? A Complete Guide for 2025
June 24 , 2025
VAPT Methodologies
VAPT Methodologies: Top modern security testing priority for Cybersecurity leaders
June 23 , 2025

Let's talk

Reach out, we'd love to hear from you!

Image CAPTCHA
Enter the characters shown in the image.
Get new captcha!

This article deep dives into what Data Access Object (DAO) is in the Java-based Spring Boot Framework. The motive is to simplify technical niceties and break down the crux in a way that can be well suited to the interested layman. Stay with us!

Explained: DAO or Data Access Object in Java

DAO stands for Data Access Object. It’s a design pattern in which a data access object (DAO) is an object that provides an abstract interface to some type of database or other persistence mechanisms. By mapping application calls to the persistence layer, DAOs provide some specific data operations without exposing details of the database. 

The isolation enabled by DAOs supports the Single responsibility principle. It separates what data accesses the application needs in terms of domain-specific objects and data types (the public interface of the DAO) and how these needs can be satisfied with a specific DBMS, database schema, etc. (the implementation of the DAO).

DAOs in Java can be helpful in situations where you don’t want to leverage the full power of the persistence layer or for cases where you need to make little changes to the underlying database. DAOs prevent developers from having to know SQL (the standard query language for databases), which can make development and debugging much faster and easier.

How Do DAOs support integration?

Need to integrate your enterprise application with a different persistence layer, but you don’t know where to begin? Java provides a comprehensive and modular framework for data access-Spring Boot, coupled with DAO-that makes integrating with different persistent layers easy. 

While developing an enterprise application, one of the most important aspects is to deal with the DB like connection management, transaction management etc. Initialization of data access objects, resource management and transaction management and exception handling are the main parts of the persistence framework. Spring data access framework is provided to integrate with different persistence frameworks like JDBC, Hibernate, JPA, iBatis etc.

Let’s take a deeper look, how JDBC and Spring are set up together to communicate to the database.

  • Setting up the Data Source

Either we can get the data source from JNDI

<bean id=”dataSourceBean” class=”org.springframework.jndi.JndiObjectFactoryBean”>

<property name=”jndiEnvironment”>

<props>

<prop key=”java.naming.initial.factory”>define value</prop>

<prop key=”java.naming.provider.url”>insert URL</prop>

</props>

</property>

<property name=”jndiName” value=”dirName”/>

</bean>

Or we can create the data source in the spring container

<bean id=” dataSourceBean” class=”org.springframework.jdbc.datasource.DriverManagerDataSource”>

<property name=”driverClassName” value=”oracle.jdbc.driver.OracleDriver”/>

<property name=”url” value=”jdbc:oracle:thin:@localhost:1521:XE”/>

<property name=”username” value=”username”/>

<property name=”password” value=”password”/>

</bean>

(BasicDataSource can also be used in place of DriverManagerDataSource)

  • Define the DAO bean

<bean id=”daoBean” class=” daoBean” init-method=”init”>

<constructor-arg ref=” dataSourceBean”/>

</bean>

  • Now write the DAO component to access the data source defined above

public class daoBean {

DataSource dataSourceBean;

Connection conn;

public daoBean (DataSource dataSourceBean){

this. dataSourceBean = dataSourceBean;

}

public void init(){

conn= dataSourceBean.getConnection();

}

public void useConnection(){

System.out.println(conn);

}

}

  • Now let’s write a simple client class to see what we are getting in the connection back

public class daoClient {

public static void main(String args[]){

BeanFactory bf=new FileSystemXmlApplicationContext(“applicationContext.xml”);

daoBean daob=( daoBean)bf.,getBean(“daoBean”);

daob.useConnection();

}

In the next part of this article we’ll explore JdbcTemplate and JdbcDaoSupport classes, what they are and how we can use them.

Want to know more?

VAPT Methodologies
Blog
VAPT Methodologies: Top modern security testing priority for Cybersecurity leaders
June 23 , 2025
5 biggest quality assurance and mobile testing challenges
Blog
5 biggest quality assurance and mobile testing challenges for app development: Quick strategies to solve them
June 16 , 2025
Testing AI applications and ML models
Blog
Testing AI applications and ML models: Revealing proven quality assurance strategies and techniques
June 11 , 2025

North America: +1.844.469.8900

Asia: +91.124.469.8900

Europe: +44.203.807.6911

Email: ask@kellton.com

Footer menu right

  • Services
  • Platforms & Products
  • Industries
  • Insights

Footer Menu Left

  • About
  • News
  • Careers
  • Contact
LinkedIn LinkedIn twitter Twitter Youtube Youtube
Recognized as a leader in Zinnov Zones Digital Engineering and ER&D services
Kellton: 'Product Challenger' in 2023 ISG Provider Lens™ SAP Ecosystem
Recognized as a 'Challenger' in Avasant's SAP S/4HANA services
Footer bottom row seperator

© 2025 Kellton