你肯定用了Annotation来配置hibernate映射吧,那么spring的sessionfactory就不能用localsessionfactorybean了,使用如下配置即可, 注意啊要用spring2.5
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="com.meritit.problemtracking.model" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
</props>
</property>
<property name="mappingResources" value="/namedQuery.hbm.xml" />
</bean>