You must go to Project Structure under Project Settings select Modules
click on green plus icon then select Hibernate Then click Ok.
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.
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: