org.hibernate.hql.internal.ast.QuerySyntaxException: XXX is not mapped

ssh框架整合时发生的一个异常,字面理解某个类没有映射导致查询异常,原来是在applicationContext.xml中配置sessionFactory时没有配置实体类的关联文件,所以导致出现此异常,下面为部分配置sessionfactory配置文件

<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.Oracle9Dialect
</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
</props>
</property>
<!-- 关联实体类映射文件 -->
<property name="mappingResources">
<list>
<value>cn/hd/po/Dept.hbm.xml</value>
</list>
</property>


</bean>

posted @ 2020-12-28 23:53  flyfish91  阅读(593)  评论(0编辑  收藏  举报