Hibernate One-To-One Mapping Tutoria
In this example you will learn how to map one-to-one relationship using Hibernate. Consider the following relationship between Student and Address entity. According to the relationship each student should have a unique address. To create this relationship you need to have a STUDENT and ADDRESS table. The relational model is shown below. To create the STUDENT and ADDRESS table you need to create the following hibernate mapping files. Student.hbm.xml is used to create the STUDENT table. view source print ? 01. <? xml version = "1.0" ?> 02. <!DOCTYPE hibernate-mapping PUBLIC 03. "-//Hibernate/Hibernate Mapping DTD 3.0//EN" 04. " http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd "> 05. < hibernate-mapping > 06. < class name = "com.vaannila.student.Student" table = "STUDENT" > 07. < meta attribute = "clas...