首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Exception >

Hibernate异常-org.hibernate.HibernateException: Hibernate Dialect must be

2014-01-26 
我的配置文件是这样 ?xml version 1.0 encoding UTF-8 ? !DOCTYPE hibernate-configuration PUBL

我的配置文件是这样
<?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 ">


<hibernate-configuration>

  <session-factory>
  <property name= "hibernate.connection.username "> sa </property>
  <property name= "hibernate.connection.url "> jdbc:microsoft:sqlserver://localhost:1433:pethospital </property>
  <property name= "hibernate.dialect "> org.hibernate.dialect.SQLServerDialect </property>
  <property name= "hibernate.connection.driver_class "> com.microsoft.jdbc.sqlserver.SQLServerDriver </property>

  <mapping resource= "pethospital/Host/hibernate/bean/HostInfo.hbm.xml "> </mapping>
  <mapping resource= "pethospital/Host/hibernate/bean/PetInfo.hbm.xml "> </mapping>
  </session-factory>

</hibernate-configuration>

异常是这样
org.hibernate.HibernateException: Hibernate Dialect must be explicitly set

at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57)

at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)

at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:378)

at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:110)

at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)

at pethospital.Host.hibernate.HibernateDAO. <clinit> (HibernateDAO.java:16)
请问如何解决

------解决方法--------------------------------------------------------
有可能是你的hibernate配置文件找不到你的映射文件
<mapping resource= "pethospital/Host/hibernate/bean/PetInfo.hbm.xml "> </mapping>
注意这句,你的包路径

        

热点排行