InterviewSolution
Saved Bookmarks
| 1. |
Explain hibernate mapping file |
|
Answer» Hibernate mapping file is an XML file that is used for defining the entity bean fields and corresponding database column mappings. In the previous example, we have defined the mapping resource as “InterviewBitEmployee.hbm.xml” in the config file. Let us SEE what that sample hbm.xml file looks like: <?xml version = "1.0" encoding = "utf-8"?><!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN""HTTP://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"><hibernate-mapping> <!-- What class is mapped to what database table--> <class name = "InterviewBitEmployee" table = "InterviewBitEmployee"> <meta attribute = "class-description"> This class CONTAINS the details of employees of InterviewBit. </meta> <ID name = "id" type = "INT" column = "employee_id"> <generator class="native"/> </id> <property name = "fullName" column = "full_name" type = "string"/> <property name = "email" column = "email" type = "string"/> </class></hibernate-mapping> |
|