java.lang.ClassCastException:java.lang.String无法强制转换为java.lang.Integer 在com.nt.dao.FeedBackDAOImpl.insertFeedBack(FeedBackDAOImpl.java:21) 在com.nt.service.FeedBackServiceImpl.registerFeedBack(FeedBackServiceImpl.java:26) 在com.nt.controller.FeedBackController.registerFeedBack(FeedBackController.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 在org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:180) 在org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:440) 在org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:428) 在org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) 在org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) 在org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) 在org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:622) 在org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) 在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) 在org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) 在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) 在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) 在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) 在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108) 在org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:522) 在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620) 在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) 在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) 在org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1110) 在org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol $ ConnectionHandler.process(AbstractProtocol.java:785) 在org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1419) 在org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:44) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61) 在java.lang.Thread.run(Thread.java:745)
//DAO CLASS
@Component
public class FeedBackDAOImpl implements FeedBackDAO {
@Autowired
private HibernateTemplate ht;
@Transactional(readOnly = false)
@Override
public int insertFeedBack(FeedBack feedBack) {
int count=0;
ht.setCheckWriteOperations(false);
count=(Integer)ht.save(feedBack);
return count;
}
}