HTTP Status 500 - Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [UPDATE rd SET LabNo=?,Category =?,ProductCode=?,StageCode=?,BatchNo=?,Analysis=?,RequestBy=?, Date1=?,ReceivedBy=?,Date2=?,RawNo=?,Test=?,Result=?,SubmittedBy=?,Date3=?, WHERE ArNo=?]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE ArNo='2015-06-07 00:00:00'' at line 1
type Exception report
message Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [UPDATE rd SET LabNo=?,Category =?,ProductCode=?,StageCode=?,BatchNo=?,Analysis=?,RequestBy=?, Date1=?,ReceivedBy=?,Date2=?,RawNo=?,Test=?,Result=?,SubmittedBy=?,Date3=?, WHERE ArNo=?]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE ArNo='2015-06-07 00:00:00'' at line 1
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [UPDATE rd SET LabNo=?,Category =?,ProductCode=?,StageCode=?,BatchNo=?,Analysis=?,RequestBy=?, Date1=?,ReceivedBy=?,Date2=?,RawNo=?,Test=?,Result=?,SubmittedBy=?,Date3=?, WHERE ArNo=?]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE ArNo='2015-06-07 00:00:00'' at line 1
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:656)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [UPDATE rd SET LabNo=?,Category =?,ProductCode=?,StageCode=?,BatchNo=?,Analysis=?,RequestBy=?, Date1=?,ReceivedBy=?,Date2=?,RawNo=?,Test=?,Result=?,SubmittedBy=?,Date3=?, WHERE ArNo=?]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE ArNo='2015-06-07 00:00:00'' at line 1
org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:233)
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:603)
org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:812)
org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:868)
org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:876)
com.elakk.dao.EmployeDaoImpl.saveorupdate(EmployeDaoImpl.java:128)
com.elakk.service.EmployeServiceImpl.saveorupdate(EmployeServiceImpl.java:32)
com.elakk.controller.EmployeeController.registerprocess(EmployeeController.java:53)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
public class EmployeeController {
@Autowired
private EmployeeService employeeService;
@RequestMapping(value = "rd", method = RequestMethod.GET)
public String showrdPage(HttpSession session) {
session.setAttribute("RD", "rd");
System.out.println("invoking rd page");
return "rd";
}
@RequestMapping(value = "rdProcess", method = RequestMethod.POST)
public String registerprocess(HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("rd") RD rd) {
@SuppressWarnings("unused")
String operation = request.getParameter("rd.getOperation");
System.out.println("bname......................" + rd.getOperation());
System.out.println("test............");
if (rd.getOperation() == "save") {
rd.setStatus("RDSave");
} else if (rd.getOperation() == "update") {
rd.setStatus("RDSubmit");
}
System.out.println("Test registerProcess");
rd = employeeService.saveorupdate(rd);
return "rd";
}
}
答案 0 :(得分:1)
更正此代码
Date3=?, WHERE
这里不应该有逗号