Issue
I just read an introductory tutorial on Hibernate that had all the mapping files inside the same source directory of the entities they represented:
TestProject/
src/main/java/
com.hibernate.tutorial.entities
Student.java
Student.hbm.xml
Course.java
Course.hbm.xml
etc. Normally, I like to place config files under src/main/config
, and so ideally I'd like to have the following project directory structure:
TestProject/
src/main/java/
com.hibernate.tutorial.entities
Student.java
Course.java
src/main/config
hibernate/
Student.hbm.xml
Course.hbm.xml
Is there a way to do this, and if so, how?
Solution
There are 2 ways to map Pojo class to hibernate entity:
- XML mapping
- Using annotations
Annotations becomes more prevalent last years. Some examples you could find here:
Answered By - Sergii Shevchyk
Answer Checked By - Pedro (JavaFixing Volunteer)