Javatpoint Logo
Javatpoint Logo

Hibernate Many to One Mapping using XML

In many to one mapping, various attributes can be referred to one attribute only.

In this example, every employee has one company address only and one address belongs to many employees. Here, we are going to perform many to one mapping using XML.

1) Persistent classes for one to one mapping

There are two persistent classes and Employee class contains Address class reference and vice versa.

2) Mapping files for the persistent classes

The two mapping files are employee.hbm.xml and address.hbm.xml.



3) Configuration file

This file contains information about the database and mapping file.

4) User classes to store and fetch the data


Hibernate Many to One Example 1 Hibernate Many to One Example 2


Hibernate Many to One Example 3


Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA