接上篇博文
在整合ssh写了一个小例子的时候出现了这个问题:
代码如下
package com.crm.biz;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.crm.info.Cuser;
@Transactional
@Service(“cuserBiz”)
public class CuserBiz extends HibernateDaoSupport{
public void add(Cuser cuser){
System.out.println(cuser.getCrm_name());
System.out.println("--------------");
try{
this.getHibernateTemplate().save(cuser);
}catch(Exception e){
e.printStackTrace();
}
}
}
我在运行的时候this.getHibernateTemplate().save(cuser);这一块报指针异常的情况;后来经过长时间的调试,终于找到了问题所在;
一开始我在Action中是这样创建的CuserBiz类,代码如下
package com.crm.action;
import org.springframework.context.annotation.Scope;
import org