1. Step 1

You must go to Project Structure under Project Settings select Modules

click on green plus icon then select Hibernate Then click Ok.

2. Step 2

Now you must assign data source to your Intellij, on the right side of Intellij window you can see this Database Icon, if doesn't exist you must mark View > Tool Buttons

click on green plus button and select Data Source and connect your database by this way.

3. Step 3

on the left side of Intellij you must see Presistence button like this below picture.

right click on getSessionFactory > Assing Data source .. then you must select your Data source to sessionFactory.

Note: if you update schema and update database you must update and sync database connected to you Intellij by click on refresh button in database window: