title: Hibernate Update query exception
body: <p>Hi I am writing the hql update query but I am getting exception as follow.And my query is like this.Could anyone please identify what would be mistake here.</p>
  
  <p><strong>Query</strong></p>
  
  <pre><code> Query Updatepriamray = s.createQuery("update EmployeeDeparment set primarydept=:primedep,status=:status where employeeentity.employeeid=:empid and primarydept=:dep");
                                          Updatepriamray.setBoolean("primedep", false);
                                          Updatepriamray.setBoolean("status", false);
                                          Updatepriamray.setInteger("empid", deparment.getEmployeeentity().getEmployeeid());
                                          Updatepriamray.setBoolean("dep", true);
                                          Updatepriamray.executeUpdate(); 
  </code></pre>
  
  <p><strong>Exception</strong></p>
  
  <p>Full stack trace:</p>
  
  <pre><code>SEVERE: Lock wait timeout exceeded; try restarting transaction
  org.hibernate.exception.GenericJDBCException: could not execute update query
          at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
          at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
          at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
          at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:84)
          at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:396)
          at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:259)
          at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1141)
          at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94)
          at com.treamis.hr.employee.HRCalss.EmployessEdit(HRCalss.java:406)
          at com.treamis.hr.employee.EditEmployeeSave.execute(EditEmployeeSave.java:32)
          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:191)
          at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
          at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
          at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
          at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
          at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
          at com.treamis.academics.examlist.SessionFilterServelet.doFilter(SessionFilterServelet.java:189)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
          at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
          at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
          at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
          at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
          at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1770)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          at java.lang.Thread.run(Thread.java:722)
      Caused by: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
          at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
          at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
          at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
          at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002)
          at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
          at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624)
          at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127)
          at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2427)
          at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2345)
          at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2330)
          at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:75)
  </code></pre>