Preface: Have been accustomed to use myeclipse automatically generate hibernate, but the manual configuration has been not very understanding, are embarrassed to say that they are engaged in Java. So hurriedly reviewed the manual configuration, and recorded here, so often come back to see!
The first step: Build the environment
Download Hibernate-distribution-3.3.2.ga-dist.zip on Hibernate homepage (this is hard to find, be patient!) ), unzip the root directory of the Hibernate3.jar and required folder all the packages, database drive jar, copied to Web-info Lib.
Then build-path the jar that you just copied over the project.
Step Two: Build the map
First create the entity class (persisted Class) corresponding to the database table field, must implement the Java.io.Serializable interface
Then, under the same package for all entity classes, create the mapping file, as follows:
Hibernate configuration file XXX.cfg.xml Example:
<?xml version= "1.0" encoding= "Utf-8"? ><! DOCTYPE hibernate-mapping Public "-//hibernate/hibernate mapping DTD 3.0//en" "http://hibernate.sourceforge.net/ HIBERNATE-MAPPING-3.0.DTD "><!--mapping file autogenerated by MyEclipse persistence Tools--> Step Three: Configure the operating environmentIn SRC, create the Hibernate profile XXX.cfg.xml, as follows:
<?xml version= ' 1.0 ' encoding= ' UTF-8 '? ><! DOCTYPE hibernate-configuration Public "-//hibernate/hibernate configuration DTD 3.0//en" "Http://hibern Ate.sourceforge.net/hibernate-configuration-3.0.dtd "><!--Generated by MyEclipse hibernate Tools. --> Ways to configure Hibernate manually