Home kellton

Main navigation

  • Services
    • Digital Business Services
      • AI & ML
        • 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
    • Tasks.io
    • Kellton4Health
    • Kellton4NFT
    • Kellton4Commerce
    • KLGAME
    • tHRive
    • Optima
    • 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
  • Insights
    • Blogs
    • Brochures
    • Success Stories
    • News / Announcements
    • Webinars
    • White Papers
  • Careers
    • Life At Kellton
    • Jobs
  • About
    • About Us
    • Our Partners
    • 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

What is Agentic AI
Agentic AI Applications: The emerging frontiers in Generative AI dynamics
May 08 , 2025
Process Mining to Optimize ServiceNow Processes
Identifying Bottlenecks and Inefficiencies: Using Process Mining to Optimize ServiceNow Processes
May 05 , 2025
ServiceNow and the Future of Human-AI Collaboration with Agentic AI
ServiceNow and the Future of Human-AI Collaboration with Agentic AI
May 02 , 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?

Quantum-proofing your business
Blog
Quantum-proofing your business: A critical security imperative
April 01 , 2025
Minimizing disruption in Product Modernization
Blog
Application Modernization Strategy: Revealing zero-disruption best practices
March 25 , 2025
Adaptive software development guide - Abstract thumbnail image
Blog
A detailed guide on adaptive software development
March 13 , 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