저는 최대 절전 모드에 익숙하며 MySQl, Hibernate 및 Struts를 사용하는 응용 프로그램에서 작업하고 있습니다. 주어진 코드에 대해 항상 다음 오류가 발생합니다. 나는이 오류 때문에 google을했지만 그 스레드는 도움이되지 못했습니다.항상 JDBC 일괄 업데이트 오류가 발생합니다
오류 난 항상 transaction.commit()
줄에서이 오류를 얻고있다
Session session = new HibernateSession().currentSession(this.getServlet().getServletContext());
if(auctionform.getId() == null || auctionform.getId().intValue() == 0){
auction.setId(null);
auctionform.setId(null);
}else{
auction.setId(auctionform.getId());
Criteria criteria = session.createCriteria(Auction.class);
criteria.add(Restrictions.idEq(Integer.valueOf(req.getParameter("id"))));
auction = (Auction) criteria.uniqueResult();
}
Boolean isAuctionActive = false;
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat formatter= new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date auctionEndingDate = DateUtils.getDate(req, "auctionenddate");
Date todaysDate = formatter.parse(formatter.format(currentDate.getTime()));
if(auctionEndingDate.after(todaysDate)){
isAuctionActive = true;
}
auction.setDescription(auctionform.getDescription());
auction.setDate(auctionform.getDate());
auction.setCurrentprice(auctionform.getCurrentprice());
....some code
Attachment attachment1 = AttachmentUtils.saveAttachment(auctionform, session, auction, 0);
Attachment attachment2 = AttachmentUtils.saveAttachment(auctionform, session, auction, 1);
Attachment attachment3 = AttachmentUtils.saveAttachment(auctionform, session, auction, 2);
Transaction transaction = session.beginTransaction();
if(attachment1!=null){
session.save(attachment1.getDbFile());
session.save(attachment1.getThmnailDbFile());
session.save(attachment1);
auction.setFirstimage(attachment1);
}
if(attachment2!=null){
session.save(attachment2.getDbFile());
session.save(attachment2.getThmnailDbFile());
session.save(attachment2);
auction.setSecoundimage(attachment2);
}
if(attachment3 != null){
session.save(attachment3.getDbFile());
session.save(attachment3.getThmnailDbFile());
session.save(attachment3);
auction.setSignimage(attachment3);
}
session.saveOrUpdate(auction);
transaction.commit();
session.flush();
javax.servlet.ServletException: Could not execute JDBC batch update
at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:516)
....
코드입니다. 나는 잘못되고있는 것을 얻지 못하고있다.
업데이트 :
I 설정 log4j에 완전한 스택 트레이스는 다음과 같습니다.
전체 스택 트레이스 내가 열에서 일부 일본어 물건을 저장하기 위해 노력하고
Caused by: java.sql.BatchUpdateException: Incorrect string value: '\xE5\x8F\x96\xE3\x82\x8A...' for column 'BIDDERRESTRICTION' at row 1
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:647)
at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:174)
... 34 more
2012-10-25 17:26:29 [action] [ERROR] Servlet.service() for servlet action threw exception
java.sql.BatchUpdateException: Incorrect string value: '\xE5\x8F\x96\xE3\x82\x8A...' for column 'BIDDERRESTRICTION' at row 1
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:647)
at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:174)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at net.startbahn.web.app.PostAuctionVPAction.execute(PostAuctionVPAction.java:175)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at net.startbahn.filters.PrivilegeManageFilter.doFilter(PrivilegeManageFilter.java:112)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at net.startbahn.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:121)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:879)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:722)
은 그래서 에 테이블의 데이터 정렬을 업데이트하려고 COLLATE = ujis_japanese_ci 및 UTF-8 여전히하지만 효과.
솔루션 :
나를 위해 트릭 UTF8-utf8_bin에 테이블의 조합뿐만 아니라 모든 필드를 않았다 설정.
로깅이별로 도움이되지 않습니다. 일부 로그 수준을 어딘가에서 줄일 수는 없습니까 (log4j.proerties). –
@drjerry : 스택 트레이스를 업데이트했습니다. –