配置SSH框架的时候有时会遇到这样的问题:User is not mapped [select u from User u where u.userName=:userName and u.password=:password] 除了是因为数据类型的原因,大部分是因为没有在applicationContext.xml配置映射,配制方法为在applicationContext.xml中加入:
1.依次加入
<property name="mappingResources">
<list>
<value>com/dwg/bean/User.hbm.xml</value>
<value>com/dwg/bean/Customer.hbm.xml</value>
</list>
</property>
2.一次性加入
<property name="mappingDirectoryLocations">
<list>
<value>com/dwg/bean/*.hbm.xml</value>
</list>
</property>