Hibernate LocalSessionFactoryBean,setMappingDirectoryLocations似乎不起作用

时间:2018-05-09 16:11:59

标签: java spring hibernate spring-mvc hibernate-mapping

我正在使用Spring 5和Hibernate 5,我正在配置Hibernate映射文件: 我的applicationContext.xml文件中的org.springframework.orm.hibernate5.LocalSessionFactoryBean是这样的:

<bean id="sessionFactory"
    class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
    <property name="mappingDirectoryLocations" value="com/myorg/division/myapp/model" />

但是当我将WAR文件部署到本地Weblogic服务器时,我收到此错误运行时错误:

Deployment Message : weblogic.application.ModuleException: java.io.FileNotFoundException: ServletContext resource [/com/
myorg/division/myapp/model] cannot be resolved to absolute file path - web application archive not expanded?

1 个答案:

答案 0 :(得分:0)

这应该做的工作

<property name="packagesToScan" value="com.myorg.division.myapp.model" />