The Hibernate mapping file (a .hbm.xml
file) and the Hibernate properties file (hibernate.properties file
) form the basis of a Hibernate application. The mapping file consists of class definitions. Each class definition consists of a set of properties to be mapped to a Java class and a database table. The field/column types and additional characteristics of the columns such as length, not-null
, and unique
are also specified with the properties. Some of the more often used tags in the mapping file are listed in the following table:
Tag Name |
Description |
Attributes |
Sub Elements |
---|---|---|---|
hibernate-mapping |
The root element |
schema, package |
class |
class |
Specifies the class definition for mapping a Hibernate Java class to a database table. |
table,schema |
id,property,set,list |
id |
Required element in a class definition. |
column,type,length |
column,generator |
property |
Specifies a class property, which corresponds to a table column and a Java... |