Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Implementing DAO | Fundamentals of Hibernate
Java Data Manipulation with Hibernate
course content

Course Content

Java Data Manipulation with Hibernate

Java Data Manipulation with Hibernate

1. JDBC Overview
2. Fundamentals of Hibernate
3. Final Touches

book
Challenge: Implementing DAO

Let's move on to practice. In the previous chapter, we implemented the DAO layer as well as the Service layer for the Employee entity. In this task, you need to do the same for the Department entity. Interfaces such as DepartmentDao and DepartmentService have already been created for you. In this task, you should work in implementation classes, such as DepartmentDaoImpl and DepartmentServiceImpl. Your task is to implement all the methods specified in the interfaces.

Here's the workflow for the task:

  1. Set up the database connection in hibernate.cfg.xml;
  2. Implement the interfaces in the implementation classes;
  3. Implement the necessary methods in the implementation classes;
  4. You can implement them similarly to how we did it in the previous chapter. It's not difficult. You just need to change the entity names;
  5. Don't forget to use HibernateUtil;
  6. Run the integration tests to check your solution.

Note

To ensure that the integration tests work correctly, you need to execute the following command in the MySQL Workbench query. This command will grant permission to delete data from the table for the tests to run correctly. Don't worry. This database is a test database; later, when we test all the necessary methods and are ready to complete the project, we will create another database that will no longer be a test one.

Command:

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 6
We're sorry to hear that something went wrong. What happened?
some-alt