读书人

Hibernate异常-org.hibernate.Hiberna

发布时间: 2014-01-26 14:35:52 作者: rapoo

我的配置文件是这样
<?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>
注意这句,你的包路径

        

读书人网 >Java Exception

热点推荐