[求助]用hibernate插入表单数据报错..
工具:myeclipse
数据库:mysql
架构是:Struts+Sping+Hibernate
项目:学生选课系统
//addstu.jsp
form是:xh,password,xm,yx,major
然后填充到AddstuForm
_____________________________________________
//AddstuFormAction的execute()方法
AddstForm addstForm = (AddstForm) form;// TODO Auto-generated method stub
Student stu=new Student();
stu.setXh(addstForm.getXh());
stu.setPassword(addstForm.getPassword());
stu.setXm(addstForm.getXm());
stu.setYx(addstForm.getYx());
stu.setMajor(addstForm.getMajor());
studentdao.save(stu);
return mapping.findForward( "succeed ");
______________________________________
//StudentDAO.java
public void save(Student transientInstance) {
log.debug( "saving Student instance ");
try {
System.out.println( "ssssssssss ");
getHibernateTemplate().save(transientInstance);
log.debug( "save successful ");
} catch (
RuntimeException re) {
log.error( "save failed ", re);
throw re;
}
}
---------------------
★tomcat可以执行到System.out.println( "ssssssssss ");
输出ssssssssss
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Hibernate operation: could not insert: [org.rockie.dao.Student]; bad SQL grammar [insert into stucourse__student (XH, PASSWORD, XM, YX, MAJOR) values (?, ?, ?, ?, ?)]; nested exception is
java.sql.SQLException: Base table or view not found, message from server: "Table 'stucourse.stucourse__student ' doesn 't exist "
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)