1: First Find hibernate-release-4.1.9.final.zip\hibernate-release-4.1.9.final\lib\required, Copy all the jar packages in the required into the Lib package under Web-inf, and then put the Odbc.jar package that accesses the database into LIB.
2: Add Hibernate.cfg.xml file (under SRC). Copy the ready-made Hibernate.cfg.xml file under Hibernate-release-4.1.9.final.zip\hibernate-release-4.1.9.final\project\etc.
Then delete the file with the Red line:
<session-factory name= "foo" ;
<property name= "Show_sql" >TRUE</PROPERTY>
<mapping resource= "Org/hibernate/test/legacy/simple.hbm.xml"/>
<class-cache
class= "Org.hibernate.test.legacy.Simple"
region= "Simple"
usage= "Read-write"/>
</session-factory>
3: After creating the package name and the entity class, the configuration map file is generally named "entity class name. hbm.xml" as the file name. And then find the Web App Libraries under the Hibernate-core-4.1.9.final.jar point open and then open the first package org.hibernate then find the penultimate file (HIBERNATE-MAPPING-3.0.DTD), double-click after the copy inside the <! DOCTYPE hibernate-mapping Public
"-//hibernate/hibernate Mapping DTD 3.0//en"
"Http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" > <?xml version= "1.0" encoding= "UTF-8"?> to the mapping file. Then simply configure it as:
<?xml version= "1.0" encoding= "UTF-8"?>
<! DOCTYPE hibernate-mapping Public
"-//hibernate/hibernate Mapping DTD 3.0//en"
"Http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" >
<class name= "Cn.jnti.bean.county" table= "T_county" >--entity class name corresponding table name
<id name= "id" >--PRIMARY key column
<generator class= "sequence" ></generator>--oracle auto-Generate sequence
</id>
<property name= "CNAME" ></property>--attribute corresponding column name
</class>
4: Again to configure the Hibernate.cfg.xml file,
Complete.
Web project Configuration Hirbernate