Add resource mapping into the hibernate.cfg.xml file.

When you want to associate a database table with Hibernate, you must remember to add resource mapping, something like:< resource=”myPack/Category.hbm.xml”>, into the hibernate.cfg.xml file. Otherwise, the data from this table can’t be found.

A solution to an problem of Hibernate: "Servlet action is not available"

if in the xx.hbm.xml file, you made a mistake,like: you write a wrong property name which doesn’t exist in the mapping class. say: “username” is a property in the class “User.class”,but you write it as “usename”. Then the problem happens, “Servlet action is not available” will display on your page.

Different versions of Hibernate

Hibernate has version 2 and version 3. There are some differences between them, so We must pay attention to these differencs when we are programming.

The solutions to the problem:ClassNotFoundException: org.hibernate.hql.ast.HqlToken

When I run the example provided by the Hibernate 3.1.3 package, “ant eg”, I got the error: “ClassNotFoundException: org.hibernate.hql.ast.HqlToken.The solutions have two which I tried and succeeded.1: place the antlr-2.7.6rc1.jar into the jdk.xxx/jre/lib/ext directory of jdk package.2: set the “hibernate.query.factory_class” to “org.hibernate.hql.classic.ClassicQueryTranslatorFactory” in the “hibernate.properties” file.3: Or add the following sentence into the hibernate.cfg.xml file:
org.hibernate.hql.classic.ClassicQueryTranslatorFactory

To run Hibernate example, We must put log4jXXX.jar into the "ext" directory of JDK

To run Hibernate example successfully, We must place log4jXXX.jar into the “jre/ext” directory of JDK (like: JDK1.5.0_06). for example, we can run the example provided by Hibernate package: “ant eg”.otherwise, it will have an error: java.lang.ExceptionInInitializerError at……….Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor …..