Take the message system as an example
1. Configure the mapping file: first you have to introduce a constrained DTD
<! DOCTYPE hibernate-mapping Public
"-//hibernate/hibernate Mapping DTD 3.0//en"
"Http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" >
Then
The <class></class> tag represents the JavaBean feature class for which you want to create a table
<id></id> Configuration Table primary key Id<generator class= "native" ><generator> native:hibernate automatically what kind of database The data is then guaranteed to be unique based on the growth of the primary key from the database type.
<proterty></proterty> to configure a table's fields
<set></set> a one-to-many label to represent that multi-collection
<one-to-one> one-on-one
<one-to-many> one-to-many
<many-to-many> Many-to-many
2. Core configuration Files
Configuration of the Hibernate mapping file configure the core file one-to-one pair multiple hibernate implementation paging Hibernate session closure problem summary