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

Зміст курсу

Java Data Manipulation with Hibernate

Java Data Manipulation with Hibernate

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

book
Challenge: Entity Creation

Note

This task will consist of 2 parts.

Setting up the connection:

Your task is to create the necessary database in MySQL using regular SQL queries. I will provide you with the codes for the table that we will use and develop in this course; you just need to insert these codes into your table.

Then, you need to connect your database to the project. I've left a template for you in hibernate.cfg.xml; you just need to insert the link to your database (I recommend using the name testDatabase, as this database will be used to test your solution. When we have a finished project, we will create a new database).

You also need to fill in the username in MySQL (most likely, it will be root) as well as your password.

Don't worry, I won't see your password :).

Here are the commands to create the database and two necessary tables in it.

Use this exact database for this task.

Note

We will continue to use this database further, so please do not delete it after completing the task.

Creating the database and using it:

Creating the employees table:

Creating the departments table:

Creating the entity class:

Next, you need to go to the Department class and make this class an entity class. Use all the necessary annotations learned in previous chapters. You can also use the Project Lombok library, or you can manually write getters, setters, and constructors. The choice is yours.

After you complete the task, run the integration tests I've written, and they will verify the correctness of your task.

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 3
We're sorry to hear that something went wrong. What happened?
some-alt