Hi every body:
I am getting a problem updating a database table called tbl_authors, I am using the DAO classes generated by the MyEclipse IDE, my version of hibernate is 3.1. Could you help me please to find the error I have made ?
Here is the piece of code to update that table:
TblAuthorsDAO dao = new TblAuthorsDAO(); TblAuthors authorObj = dao.findById(Integer.parseInt(idAuthor)); authorObj.setName(author); Session session = dao.getSession(); Transaction tx = session.beginTransaction(); dao.save(authorObj); tx.commit(); session.close();
An this is the error I get:
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update 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.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297) at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41) at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:954) at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1121) at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94) at cu.co.cenatav.services.DocumentsServiceImpl.updateAuthorOfDoc(DocumentsServiceImpl.java:202) at cu.co.cenatav.services.DocumentsServiceImpl.main(DocumentsServiceImpl.java:148) Caused by: java.sql.BatchUpdateException: Lock wait timeout exceeded; try restarting transaction at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1237) at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:936) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
I don't know why is this happening with this table, authors table is the only one that raised this error, with users table and references table this doesn't happen. The authors table has an unique index, has this anything to do with the error ???
Thanks in advanced for your help
Regards
Ariel
|