异常信息:
org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access; nested exception is org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
问题简述:
每个学生在录入students表时,给result表对应的录入信息(这两个表的主键都是学号)
相关代码:
[code="java"]
JSONObject obj = JSONObject.fromObject(js);
Students s=(Students)JSONObject.toBean(obj,Students.class);
Classes cls=(Classes)request.getSession().getAttribute("cls_ajax");
s.setClasses(cls);
s.setMajor(cls.getMajor());
s.setPwd("0000");
s.setFlag(0);
ssi.addStudent(s);//插入学生,成功
Result res=new Result();
res.setFlag(0);
res.setStudentId(s.getId());
res.setTeachers("");
res.setThesis("");
rsi.addResult(res);//插入结果,失败
[/code]
关于rsi.addResult(res)的方法:(异常信息就是在这里打印出来的)
[code="java"]
public void addResult(Result maj) {
try
{
resDao.insert(maj);
}
catch(Exception e)
{
System.out.println(e.toString());
}
}
[/code]
关于Result的实体和Hibernate配置文件:
[code="java"]
public class Result implements java.io.Serializable {
// Fields
private String studentId;
private String thesis;
private String teachers;
private Byte change;
private Integer flag;
[/code]
[code="java"]
[/code]