我配置了spring的xml,但是要查询数据的时候显示为null,后来打印getHibernateTemplate的时候显示为null
配置文件:<!-- 后台的dao,真正的实现了verify方法来验证前台管理员是否存在 *3-->
<bean id="DBAdminsDAO" class="com.guidepost.bgdao.impl.DBAdminsDAOImpl">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<!-- 中间层的dao,封装了验证前台、系统管理员的方法,调用了后台的dao *2-->
<bean id="AdminsDAO" class="com.guidepost.middledao.impl.AdminsDAOImpl">
<property name="dba">
<ref bean="DBAdminsDAO"/>
</property>
</bean>
<!-- spring管理前台管理员登陆的action,应用中间层的dao *1 -->
<bean name="/prelogin" class="com.guidepost.struts.action.PreLoginAction">
<property name="adminsDAO">
<ref bean="AdminsDAO"/>
</property>
</bean>
<!-- spring管理系统管理员登陆的action,应用中间层的dao -->
<bean name="/syslogin" class="com.guidepost.struts.action.SysLoginAction">
<property name="adminsDAO">
<ref bean="AdminsDAO"/>
</property>
</bean> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="datasource" />
</property><bean>
spring大致就是上面的,大家帮忙解决下,
配置文件:<!-- 后台的dao,真正的实现了verify方法来验证前台管理员是否存在 *3-->
<bean id="DBAdminsDAO" class="com.guidepost.bgdao.impl.DBAdminsDAOImpl">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<!-- 中间层的dao,封装了验证前台、系统管理员的方法,调用了后台的dao *2-->
<bean id="AdminsDAO" class="com.guidepost.middledao.impl.AdminsDAOImpl">
<property name="dba">
<ref bean="DBAdminsDAO"/>
</property>
</bean>
<!-- spring管理前台管理员登陆的action,应用中间层的dao *1 -->
<bean name="/prelogin" class="com.guidepost.struts.action.PreLoginAction">
<property name="adminsDAO">
<ref bean="AdminsDAO"/>
</property>
</bean>
<!-- spring管理系统管理员登陆的action,应用中间层的dao -->
<bean name="/syslogin" class="com.guidepost.struts.action.SysLoginAction">
<property name="adminsDAO">
<ref bean="AdminsDAO"/>
</property>
</bean> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="datasource" />
</property><bean>
spring大致就是上面的,大家帮忙解决下,
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="datasource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="show_sql">true</prop>
<prop key="hibernate.connection.autocommit">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>
com/china/guidepost/entity/Student.hbm.xml
</value>
<value>
com/china/guidepost/entity/Rolesaction.hbm.xml
</value>
<value>
com/china/guidepost/entity/Vipstudent.hbm.xml
</value>
<value>
com/china/guidepost/entity/Stuteac.hbm.xml
</value>
<value>
com/china/guidepost/entity/Clasubject.hbm.xml
</value>
<value>com/china/guidepost/entity/Roles.hbm.xml</value>
<value>com/china/guidepost/entity/Action.hbm.xml</value>
<value>
com/china/guidepost/entity/Studclass.hbm.xml
</value>
<value>
com/china/guidepost/entity/Leaveapp.hbm.xml
</value>
<value>com/china/guidepost/entity/Module.hbm.xml</value>
<value>
com/china/guidepost/entity/Absenteeism.hbm.xml
</value>
<value>
com/china/guidepost/entity/Teacher.hbm.xml
</value>
<value>
com/china/guidepost/entity/Teacherreplace.hbm.xml
</value>
<value>
com/china/guidepost/entity/Vipteac.hbm.xml
</value>
<value>
com/china/guidepost/entity/Teacsub.hbm.xml
</value>
<value>
com/china/guidepost/entity/Vipstuclass.hbm.xml
</value>
<value>
com/china/guidepost/entity/Subject.hbm.xml
</value>
<value>com/china/guidepost/entity/Admins.hbm.xml</value>
<value>
com/china/guidepost/entity/Rolesmodule.hbm.xml
</value>
<value>
com/china/guidepost/entity/Studentclass.hbm.xml
</value></list>
</property></bean>
这是我的sessionfactory种的配置