一直报错这个 attempt to create saveOrUpdate event with null entity 求助 快逼疯了

实体类
package com.user.bean;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name="clas")
public class Student {

@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
@Column(length=600,nullable=false)
private String name;
@Column(length=600,nullable=false)
private String desc;
@Column(length=600,nullable=false)
private String remark;


public int getId() {
    return id;
}
public void setId(int id) {
    this.id = id;
}
public String getClas() {
    return name;
}
public void setClas(String clas) {
    this.name = clas;
}
public String getDesc() {
    return desc;
}
public void setDesc(String desc) {
    this.desc = desc;
}
public String getRemark() {
    return remark;
}
public void setRemark(String remark) {
    this.remark = remark;
}

}

dao里面
package com.user.dao.impl;

import javax.annotation.Resource;

import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

import com.user.bean.Student;
@Repository
public class IStudentDao extends HibernateDaoSupport implements com.user.dao.IStudentDao {
@Resource(name="sessionFactory")
public void setHibernateSessionFactroy(SessionFactory sessionFactory){
this.setSessionFactory(sessionFactory);
}

//添加分类
public void addStudent(Student student) {
    // TODO Auto-generated method stub
    this.getHibernateTemplate().save(student);


}

}

service里面

package com.user.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.user.dao.IStudentDao;
import com.user.bean.Student;
@Service
public class StudentService implements com.user.service.StudentService {
@Resource
private IStudentDao studentDao;

@Transactional(readOnly=false,propagation=Propagation.REQUIRED)
public void addStudent(Student student) {
    // TODO Auto-generated method stub
    studentDao.addStudent(student);

}

}

Action里面

package com.user.action;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionSupport;
import com.user.bean.Student;
import com.user.service.StudentService;

@Controller
@Scope("prototype")
public class StudentAction {
@Resource
private StudentService studentService;
private Student student;

//查询分类管理
public String list() {
    return "list";
}
//到添加的页面
public String toAddpage() {

    return "toAddpage";                                                                                                                                                                
}
//添加的方法
public String add() {
    studentService.addStudent(student);
    return "add";
}

}

jsp里面

分类名称
10字以内...
分类描述
10字以内...
备注
250字以内...
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!