如我在我的Hibernate配置文件命名空間,給了我這些警告:Hibernate的問題用我目前使用<a href="http://hibernate.sourceforge.net" rel="nofollow">http://hibernate.sourceforge.net</a> http://www.hibernate.org/dtd
公認過時的休眠命名空間 http://hibernate.sourceforge.net/ 。改爲使用命名空間 http://www.hibernate.org/dtd/。請參考休眠3.6 遷移指南!
因此,我嘗試將hibernate.cfg.xml和所有其他* .hbm.xml文件切換爲使用http://www.hibernate.org/dtd。但是後來當我嘗試在Eclipse中使用Hibernate工具生成的代碼我收到以下錯誤消息(代碼生成正常工作與其他命名空間):
org.hibernate.HibernateException:無法解析配置: Ç :\ dev \ workspace \ DataLoad \ hibernate.cfg.xml無法解析配置:C:\ dev \ workspace \ DataLoad \ hibernate.cfg.xml
org.dom4j.DocumentException:www.hibernate.org嵌套異常: www.hibernate.org www.hibernate.org嵌套異常: www.hibernate.org org.dom4j.DocumentException:www.hibernate.org嵌套異常:www.hibernate.org www.hibernate.org嵌套異常:www.hibernate.org
這裏是我的hibernate.cfg.xml:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/findata?tcpKeepAlive=true
</property>
<property name="connection.username">root</property>
<property name="connection.password">xxxxxxxx</property>
<property name="connection.pool_size">2</property>
<property name="show_sql">true</property>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="current_session_context_class">thread</property>
<property name="cache.provider_class">
org.hibernate.cache.NoCacheProvider
</property>
<mapping resource="conf/Alert.hbm.xml" />
<mapping resource="conf/Entity.hbm.xml" />
<mapping resource="conf/FactData.hbm.xml" />
<mapping resource="conf/TimeEvent.hbm.xml" />
<mapping resource="conf/User.hbm.xml" />
<mapping resource="conf/AlertTarget.hbm.xml" />
<mapping resource="conf/LogAlert.hbm.xml" />
<mapping resource="conf/RepeatType.hbm.xml" />
<mapping resource="conf/Schedule.hbm.xml" />
<mapping resource="conf/Task.hbm.xml" />
<mapping resource="conf/JobQueue.hbm.xml" />
<mapping resource="conf/LogTask.hbm.xml" />
<mapping resource="conf/Exclude.hbm.xml" />
<mapping resource="conf/LogNotification.hbm.xml" />
<mapping resource="conf/Job.hbm.xml" />
<mapping resource="conf/Metric.hbm.xml" />
<mapping resource="conf/EntityGroup.hbm.xml" />
<mapping resource="conf/ExtractSingle.hbm.xml" />
</session-factory>
</hibernate-configuration>
不,我不工作。給出了更多的錯誤。 – Siddharth
什麼樣的錯誤? – Foyta