日期:2014-05-18  浏览次数:20829 次

hibernate3.6+spring3.2+jpa(hibernate-annotations-3.4)配置问题
我的applicationContext.xml文件配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
http://www.springframework.org/schema/tx 
http://www.springframework.org/schema/tx/spring-tx.xsd 
http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop.xsd">
    
    <bean id="pum" class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
      <property name="persistenceXmlLocations">
        <list>
          <value>classpath:META-INF/persistence.xml</value>
        </list>
      </property>
      <!--  comment dataSourceLooup to use jndi -->  
      <property name="dataSourceLookup">  
            <bean class="org.springframework.jdbc.datasource.lookup.BeanFactoryDataSourceLookup" />  
      </property>  
     
    </bean>
    
    <bean id="oracleJpaVendor"  
        class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">  
         <property name="showSql" value="true" />  
         <property name="generateDdl" value="true" />  
    </bean>   
    
    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
      <property name="persistenceUnitManager" ref="pum"/>
      <property name="persistenceUnitName" value="loganalyze"/>
      <property name="jpaVendorAdapter" ref="oracleJpaVendor" />  
      <property name="loadTimeWeaver">  
         <bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />  
      </property>  
      <property name="jpaDialect">  
         <bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/>  
      </property>  
    </bean>

<bean id="transactionManager"
class="o