日期:2014-05-17  浏览次数:20692 次

加载Hibernate的报错了,求解。
加载Hibernate的报错了,求解。
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pmTransactionManager' defined in ServletContext resource [/pm/conf/pm_spring_persistence.xml]: Cannot resolve reference to bean 'pmEntityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pmEntityManagerFactory' defined in ServletContext resource [/pm/conf/pm_spring_persistence.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pmEntityManagerFactory' defined in ServletContext resource [/pm/conf/pm_spring_persistence.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:698)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at org.springframework.orm.jpa.LocalEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalEntityManagerFactoryBean.java:85)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:237)
 


------解决方案--------------------
配置文件找不到。
------解决方案--------------------
lz这个文件/pm/conf/pm_spring_persistence.xml 里的 bean配置项pmTransactionManager 的ref引用pmEntityManagerFactory有问题。lz仔细看看
------解决方案--------------------
难道是没有设置方言dialect?
------解决方案--------------------
pmTransactionManager这个的配置信息找不到
------解决方案--------------------
pmTransactionManager这个的配置信息找不到 

------解决方案--------------------
Cannot resolve reference to bean 'pmEntityManagerFactory' while setting bean property 'entityManagerFactory';

一个是pmEntityManagerFactory一个是entityManagerFactory吧
------解决方案--------------------
Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: Hibernate Dialect must be explicitly set

你什么数据库?设置的什么方言?

mysql的话:hibernate.dialect是

org.hibernate.dialect.MySQLDialect

或者写你自己的方言继承至哪个方言也可以、
------解决方案--------------------
数据库方言没有设置,要你明确的指定数据库方言!