One-To-Many Hibernate Mapping
One to Many Mapping: A single attribute of a table relating with multiple attributes of another table is referred as One to Many mapping.
A department may have multiple employees.
1. Create Database Name is mapping and Two Table are employee1 and department.
Open NetBeans See The Menu Bar go to the file Menu Click on the New Project(Ctrl+Shift+N) and Select Left site categories java web and Project categories to Right Site Project web Application .You have to give The Program Name "OnetoManyMapping". if you wont to save Project Location you can Browse and File save on the direction place and Gone a default Place and Now uncheck/check the check box and click on the next button, select server settings and select the frameworks like Hibernate and go to the finish.
2. hibernate.cfg.xml
3. hibernate.reveng.xml
4. Employee1.java
5. Department.java
6. Employee1.hbm.xml
7. Department.hbm.xml
8. OnetoMany.java
OUTPUT:
1. Create Database Name is mapping and Two Table are employee1 and department.
Open NetBeans See The Menu Bar go to the file Menu Click on the New Project(Ctrl+Shift+N) and Select Left site categories java web and Project categories to Right Site Project web Application .You have to give The Program Name "OnetoManyMapping". if you wont to save Project Location you can Browse and File save on the direction place and Gone a default Place and Now uncheck/check the check box and click on the next button, select server settings and select the frameworks like Hibernate and go to the finish.
2. hibernate.cfg.xml
3. hibernate.reveng.xml
4. Employee1.java
5. Department.java
6. Employee1.hbm.xml
7. Department.hbm.xml
8. OnetoMany.java
OUTPUT:
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment
Please Write a Message for Programming or something Related issues.