title: MySQL: java.sql.BatchUpdateException: Duplicate entry '242-243' for key 'PRIMARY'
body: <p>I have a problem with MySQL, at 4.00 PM my webApp i think cannot reach MySQL because of this errors: </p>
  
  <pre><code>    com.webratio.rtx.RTXException: Unable to perform process transition 'startProcess[startActivityTypeOid:2][parameters:gruppoOid=1, idCliente=2613, scontoOcc={}, barcode=10AA1107]'
      at com.webratio.units.bpm.core.ProcessController.handleProcessTransition(ProcessController.java:137)
      at com.webratio.units.bpm.services.ProcessUnitService.createUnitBean(ProcessUnitService.java:151)
      at com.webratio.units.bpm.services.AbstractBPUnitService.getUnitBean(AbstractBPUnitService.java:144)
      at com.webratio.units.bpm.services.AbstractBPUnitService.execute(AbstractBPUnitService.java:107)
      at com.webratio.struts.actions.OperationAction.executeOperation(OperationAction.java:393)
      at com.webratio.struts.actions.OperationAction.doExecute(OperationAction.java:249)
      at com.webratio.struts.actions.OperationAction.execute(OperationAction.java:74)
      at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
      at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
      at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
      at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
      at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
      at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
      at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
      at com.webratio.struts.servlets.WRActionServlet.process(WRActionServlet.java:155)
      at com.webratio.struts.servlets.WRActionServlet.doPost(WRActionServlet.java:99)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:719)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:465)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:390)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:317)
      at com.webratio.struts.chain.commands.PerformForward2.handleAsForward(PerformForward2.java:101)
      at com.webratio.struts.chain.commands.PerformForward2.perform(PerformForward2.java:83)
      at org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
      at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
      at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
      at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
      at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
      at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
      at com.webratio.struts.servlets.WRActionServlet.process(WRActionServlet.java:155)
      at com.webratio.struts.servlets.WRActionServlet.doPost(WRActionServlet.java:99)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at com.webratio.struts.filters.StaticResourceFilter.doFilter(StaticResourceFilter.java:78)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)
      at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2500)
      at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2489)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Unknown Source)
  
  
  
  Caused by: com.webratio.rtx.RTXException: Unable to start process (startEventOid:2)
      at com.webratio.units.bpm.core.ProcessController$StartProcessCommand.computeOperations(ProcessController.java:557)
      at com.webratio.units.bpm.core.ProcessCommand.execute(ProcessCommand.java:184)
      at com.webratio.units.bpm.core.ProcessController.handleProcessTransition(ProcessController.java:107)
      ... 64 more
  Caused by: java.lang.reflect.UndeclaredThrowableException
      at com.webratio.units.bpm.core.$Proxy3.flush(Unknown Source)
      at com.webratio.units.bpm.core.handlers.ProcessHandler.connectActivityInstances(ProcessHandler.java:1007)
      at com.webratio.units.bpm.core.handlers.ProcessHandler.normalFlow(ProcessHandler.java:256)
      at com.webratio.units.bpm.core.handlers.ProcessHandler.normalFlow(ProcessHandler.java:122)
      at com.webratio.units.bpm.core.handlers.ProcessHandler.startProcess(ProcessHandler.java:109)
      at com.webratio.units.bpm.core.ProcessController$StartProcessCommand.computeOperations(ProcessController.java:550)
      ... 66 more
  Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.GeneratedMethodAccessor234.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at com.webratio.units.bpm.core.TXSession$SessionInvocationHandler.invoke(TXSession.java:206)
      ... 72 more
  Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
      at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:262)
      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:181)
      at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
      at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
      at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
      ... 76 more
  Caused by: java.sql.BatchUpdateException: Duplicate entry '242-243' for key 'PRIMARY'
      at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2020)
      at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1451)
      at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
      at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
      at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
      at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
      at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
      ... 81 more
  </code></pre>
  
  <p>I have no idea what it is because it is never happened to me. 
  I am stuck at this, so I thank you in advance for some advices.</p>