日期:2014-05-20  浏览次数:20877 次

hibernate2升级到hibernate3的报错问题 急。。。
架构是struts+spring+hibernate 
现在是hibernate2想升级到hibernate3 
更新了相关的jar包和引用的地方,现在启动的时候报错 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'monthPlanService' defined in ServletContext resource 
[/WEB-INF/ipms-config/plan/monthPlan-spring.xml]: Cannot resolve reference to bean 'hibernateTransactionManager' while setting bean propert 
y 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernat 
eTransactionManager' defined in ServletContext resource [/WEB-INF/ipms-config/global-spring.xml]: Cannot resolve reference to bean 'sessionF 
actory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error cre 
ating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/ipms-config/global-spring.xml]: Initialization of bean fa 
iled; nested exception is org.hibernate.MappingException: could not instantiate id generator 

org.hibernate.MappingException: could not instantiate id generator 
  at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:98) 
  at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152) 
  at org.hibernate.impl.SessionFactoryImpl. <init>(SessionFactoryImpl.java:192) 
  at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294) 


配置文件在hibernate2下是没有问题的 
<?xml version="1.0"?> 
<!DOCTYPE hibernate-mapping PUBLIC 
  "-//Hibernate/Hibernate Mapping DTD 3.0//EN" 
  "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" > 

<hibernate-mapping> 
<!-- 
Created by the Middlegen Hibernate plugin 2.1 

http://boss.bekk.no/boss/middlegen/ 
http://www.hibernate.org/ 
--> 

<class name="com.etong.pm.plan.month.model.PlanMonth" 
table="et_plan_month"> 

<id name="id" type="java.lang.String" column="id"> 
<generator class="uuid.hex" /> 
</id> 

<property name="planYear" type="java.lang.Integer" 
column="plan_year" length="10" /> 
<property name="planMonth" type="java.lang.Integer" 
column="plan_month" length="10" /> 
<property name="planQuarter" type="java.lang.Integer" 
column="plan_quarter" length="10" /> 
<property name="writeTime" type="java.sql.Timestamp" 
column="write_time" length="23" /> 
<property name="writeCompany" type="java.lang.String" 
column="write_company" length="200" /> 
<property name="writer" type="java.lang.String" 
column="writer" length="20" /> 
<property name="miniDivideUnit" type="java.lang.String" 
column="mini_divide_unit" length="64" /> 
<property name="flowState" type="java.lang.String" 
column="flowstate" length="64" /> 
<property name="contractId" type="java.lang.String" 
column="contract_id" length="64" /> 
<property name="memo" type="java.lang.String" column="memo"