//这是houseDaoImpl类 @Repository("houseDao") public class HouseDaoImpl extends HibernateDaoSupport implements HouseDao { @Resource(name="sessionFactory") public void setSessionFactoryDI(SessionFactory sessionFactory) { //调用父类的setSessionFactory方法,注入sessionFactory super.setSessionFactory(sessionFactory); } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public List<House> findPage(final Integer pageno) { final String hql="select new House(a.id,a.title,a.rent,a.issuetime) from THouseinfo a "; return this.getHibernateTemplate().executeFind(new HibernateCallback() { @Override public Object doInHibernate(Session session) throws HibernateException, SQLException { return FindPage.getList(session, hql, pageno); } }); }
这是配置文件 <context:annotation-config></context:annotation-config> <context:component-scan base-package="com.dao,com.service,com.action"></context:component-scan> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"> </property> <property name="url" value="jdbc:oracle:thin:@localhost:1521:orcl"> </property> <property name="username" value="scott"></property> <property name="password" value="tiger"></property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.Oracle9Dialect </prop> <prop key="show_sql">true</prop> <prop key="format_sql">true</prop> </props> </property> <property name="mappingResources"> <list> <value>com/pojo/THousetype.hbm.xml</value> <value>com/pojo/TCounty.hbm.xml</value> <value>com/pojo/TUser.hbm.xml</value> <value>com/pojo/THouseinfo.hbm.xml</value> <value>com/pojo/TStreet.hbm.xml</value></list> </property></bean>
下面是错误信息
[cause=java.lang.ClassNotFoundException: House]