-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Update problem with hibernate and mysql
PostPosted: Fri Aug 17, 2007 3:32 pm 
Newbie

Joined: Fri Aug 17, 2007 1:45 pm
Posts: 9
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.