裡面包含了所有需要用到的jar
要替換的jar有
hibernate3.jar
antlr-2.7.6.jar(舊版請移除)
新增加的jar
hibernate-jpa-2.0-api-1.0.0.Final.jar
常見問題:
1. 錯誤訊息:Exception in thread “main” java.lang.NoClassDefFoundError: javax/persistence/EntityListeners
解決方式:缺少hibernate-jpa-2.0-api-1.0.0.Final.jar,放入即可。
2. 錯誤訊息:java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I
解決方式:antlr的版本不對或是有多個antlr互相衝突
3. 錯誤訊息:WARN [org.hibernate.util.DTDEntityResolver] – recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
解決方式:
<?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">將hbm.xml,如上面xml第四行
http://hibernate.sourceforge.net修改為 http://www.hibernate.org/dtd