我配置了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大致就是上面的,大家帮忙解决下,
解决方案 »
- 使用JSP+JavaBean+Servlet完成一个小型的网站
- 用java怎么实现用摄像头录像并播放出来的功能
- 请教关于spring声明事务的问题,望高手赐教!!!!!
- 诚心请教(急......)帮帮忙
- hibernate如何使用?
- 急问:如何将tomcat下的web应用迁移到Resin下?
- VM中安装VM TOOLS出现问题
- javax.xml.stream.XMLStreamException: java.net.MalformedURLException
- 100分!求一个错误问题!!
- sun的xml开发包中,哪一个包含XmlDocument类,麻烦贴一个了?!谢了。。。
- 请教一个ajax+JSP登录程序的问题
- 如何设置上传的服务器路径,本地路径没问题!
<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种的配置