Hibernate 更新是 出现Could not execute JDBC batch update错误 新人求指导~
publicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletEx...
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
savebookDao sbd=new savebookDao();
String bookid=request.getParameter("bookid");
String bookname=request.getParameter("bookname");
String cbsid=request.getParameter("cbsid");
String bookauthor=request.getParameter("bookauthor");
String bookprice=request.getParameter("bookprice");
String bookfl=request.getParameter("bookfl");
sbd.updateBook(bookid, bookname, cbsid, bookauthor, bookprice, bookfl);
public void updateBook(String bookid,String bookname,String cbsid,String bookauthor,String bookprice,String bookfl){
Session session=HibernateSessionFactory.getSession();
Transaction tran=session.beginTransaction();
Book book=(Book)session.get(Book.class, bookid);
book.setBookname(bookid);
book.setBookname(bookname);
book.setCbsid(cbsid);
book.setBookauthor(bookauthor);
book.setBookprice(bookprice);
book.setBookfl(bookfl);
session.update(book);
tran.commit();
}
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142)
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
Dao.savebookDao.updateBook(savebookDao.java:35)
severlet.UpdateBookSeverlet.doGet(UpdateBookSeverlet.java:24)
severlet.UpdateBookSeverlet.doPost(UpdateBookSeverlet.java:31)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 展开
throws ServletException, IOException {
savebookDao sbd=new savebookDao();
String bookid=request.getParameter("bookid");
String bookname=request.getParameter("bookname");
String cbsid=request.getParameter("cbsid");
String bookauthor=request.getParameter("bookauthor");
String bookprice=request.getParameter("bookprice");
String bookfl=request.getParameter("bookfl");
sbd.updateBook(bookid, bookname, cbsid, bookauthor, bookprice, bookfl);
public void updateBook(String bookid,String bookname,String cbsid,String bookauthor,String bookprice,String bookfl){
Session session=HibernateSessionFactory.getSession();
Transaction tran=session.beginTransaction();
Book book=(Book)session.get(Book.class, bookid);
book.setBookname(bookid);
book.setBookname(bookname);
book.setCbsid(cbsid);
book.setBookauthor(bookauthor);
book.setBookprice(bookprice);
book.setBookfl(bookfl);
session.update(book);
tran.commit();
}
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142)
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
Dao.savebookDao.updateBook(savebookDao.java:35)
severlet.UpdateBookSeverlet.doGet(UpdateBookSeverlet.java:24)
severlet.UpdateBookSeverlet.doPost(UpdateBookSeverlet.java:31)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 展开
1个回答
2012-06-07
展开全部
book.setBookname(bookid);
book.setBookname(bookname);
这个是不是写错了...
book.setBookname(bookname);
这个是不是写错了...
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询