4
我試圖讓Spring和Hibernate在沒有persistence.xml的情況下工作。我在我的context.xml文件中設置了我的實體包掃描器,如下所示:錯誤:沒有從{classpath *:META-INF/persistence.xml}解析持久性單元
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"/>
<property name="hibernateProperties" ref="hibernatePropertiesConfigurer"/>
<property name="packagesToScan" value="com.therubythree.simpleapi.entities"/>
</bean>
我在想什麼?
我不斷收到錯誤:
No persistence units parsed from {classpath*:META-INF/persistence.xml}
沒有屬性persistenceXmlLocation。你確定嗎? – CuriousMind
@CuriousMind是的,https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean.html#setPersistenceXmlLocation-java.lang.String- – eis