Hibernate Many to One Mapping using XMLIn 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 mappingThere are two persistent classes Employee.java and Address.java. Employee class contains Address class reference and vice versa. Employee.javaAddress.java2) Mapping files for the persistent classesThe two mapping files are employee.hbm.xml and address.hbm.xml. employee.hbm.xmladdress.hbm.xml3) Configuration fileThis file contains information about the database and mapping file. 4) User classes to store and fetch the dataStore.javaOutputFetch.javaOutputDownloadNext TopicHibernate Many to One using Annotation |