Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (13.1k points)
Can anyone help me what is DAO(Data Access Object) in Java? How can I use it?

1 Answer

0 votes
by (26.7k points)

Basically, Data Access Object is an object or interface which helps you to provide access to an underlying database or storage. Given below is an example of DAO:

public class Employee {

    private int id;

    private String name;

    public int getId() {

        return id;

    }

    public void setId(int id) {

        this.id = id;

    }

    public String getName() {

        return name;

    }

    public void setName(String name) {

        this.name = name;

    }

}

interface EmployeeDAO {

    List<Employee> findAll();

    List<Employee> findById();

    List<Employee> findByName();

    boolean insertEmployee(Employee employee);

    boolean updateEmployee(Employee employee);

    boolean deleteEmployee(Employee employee);

}

I hope this will help.

Want to become a Java expert? join Java Certification now!!

Want to know more about Java? Watch this video on Java Tutorial for Beginners | Java Programming :

Related questions

Browse Categories

...