2011-07-10 5 views
2

私のアプリケーションは、entityManagerFactoryを見ることができません。私のweb.xmlに:あなたはあなたのApplicationContextでセットアップJPA-のEntityManagerFactory BeanをすべきentityManagerFactoryを見ることができません

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'entityManagerFactory' is defined

+0

あなたのディスパッチャサーブレットのweb.xmlの設定を投稿することができますか? –

答えて

1

<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> 
    <property name="jpaVendorAdapter"> 
     <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> 
      <property name="showSql" value="true" /> 
      <property name="generateDdl" value="true" /> 
      <property name="databasePlatform" value="org.hibernate.dialect.MySQLDialect" /> 
     </bean> 
    </property> 
    <property name="persistenceUnitName" value="MontyBroganPU" /> 
    <property name="dataSource" ref="dataSource" /> 

</bean> 

が、私はまだエラーを得た:春-servlet.xmlで

<filter> 
    <filter-name>SpringOpenEntityManagerInViewFilter</filter-name> 
    <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class> 
    <init-param> 
     <param-name>entityManagerFactoryBeanName</param-name>  
     <param-value>entityManagerFactory</param-value>  
    </init-param> 
</filter> 

<filter-mapping> 
    <filter-name>SpringOpenEntityManagerInViewFilter</filter-name> 
    <url-pattern>/*</url-pattern> 
</filter-mapping> 

.xml、おそらくあなたのdataSource beanで。あなたがそれを行うことができますどのように見てみましょう:

http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/orm.html#orm-jpa-setup

関連する問題