`
chakey
  • 浏览: 364362 次
  • 性别: Icon_minigender_1
  • 来自: 水星
社区版块
存档分类
最新评论

错误信息No SessionFactory specified的解决方法

    博客分类:
  • Java
阅读更多

2011-05-09 13:59:54,125 INFO  [STDOUT] Job NMS.SOC_StatPOlicy_1 threw an unhandled Exception: 
java.lang.IllegalArgumentException: No SessionFactory specified
	at org.springframework.util.Assert.notNull(Assert.java:112)
	at org.springframework.orm.hibernate3.SessionFactoryUtils.doGetSession(SessionFactoryUtils.java:283)
	at org.springframework.orm.hibernate3.SessionFactoryUtils.getSession(SessionFactoryUtils.java:235)
	at org.springframework.orm.hibernate3.HibernateTemplate.getSession(HibernateTemplate.java:475)
	at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
	at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:344)
	at com.officeten.nms.task.schedul.dao.impl.RunQuartzDaoImpl.executeSQL(RunQuartzDaoImpl.java:367)
	at com.officeten.nms.task.schedul.dao.impl.RunQuartzDaoImpl.updateStatPolicyDate(RunQuartzDaoImpl.java:344)
	at com.officeten.nms.task.schedul.service.impl.RunQuartzServiceImpl.updateStatPolicyDate(RunQuartzServiceImpl.java:113)
	at com.officeten.nms.task.schedul.QuartzStatPolicyJob.executeInternal(QuartzStatPolicyJob.java:21)
	at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)

 解决方法:

private SessionFactory sessionFactory;

public void setQuartzSssionFactory(SessionFactory sessionFactory) {
        this. sessionFactory = sessionFactory;
}

HibernateTemplate  hibernateTemplate = new HibernateTemplate(sessionFactory); 

List<Object[]> list = hibernateTemplate.executeFind(
                new HibernateCallback() {
… …
}
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics