-->
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.  [ 2 posts ] 
Author Message
 Post subject: Problem with Inserting a row in to the table, nothing fancy
PostPosted: Thu Oct 13, 2005 11:14 am 
Newbie

Joined: Thu Oct 13, 2005 11:08 am
Posts: 5
Hibernate version: 3

Mapping documents: the file was generated by Hibernate EclipsePlugin
<class name="biz.intesy.tracker.domain.user.EmployeeEducation" table="employee_education">
<id name="employeeEducationId" type="long">
<column name="employee_education_id" />
<generator class="assigned" />
</id>
<property name="educationStart" type="integer">
<column name="education_start" />
</property>
<property name="educationEnd" type="integer">
<column name="education_end" />
</property>
<property name="institution" type="string">
<column name="institution" length="250" />
</property>
<property name="city" type="string">
<column name="city" length="250" />
</property>
<property name="countryId" type="long">
<column name="country_id" unique="true" />
</property>
<property name="employeeId" type="long">
<column name="employee_id" not-null="true" unique="true" />
</property>
</class>

Code between sessionFactory.openSession() and session.close():
Session sess = null;
try {
sess = HibernateSMSSessionFactory.getSession();
Transaction x = sess.beginTransaction();
EmployeeEducation emEd = new EmployeeEducation();
emEd.setCity(city);
emEd.setCountryId(new Long(country));
emEd.setEducationEnd(new Integer(eduend));
emEd.setEducationStart(new Integer(edubegin));
emEd.setInstitution(institution);
emEd.setEmployeeEducationId(id);
emEd.setEmployeeId(smsEmployeeID);
//sess.save(emEd);
sess.persist(emEd);
x.commit();
} catch (ApplicationConfigurationException ace) {
log.error(EmployeeEducationModelFacade.class + "insertEducation(Long, HttpServletRequest) error", ace);
} finally {
if (sess != null) {
sess.flush();
sess.close();
}
}

Full stack trace of any exception that occurs:
(util.JDBCExceptionReporter 71 ) SQL Error: 1205, SQLState: HY000
(util.JDBCExceptionReporter 72 ) Lock wait timeout exceeded; try restarting transaction
(def.AbstractFlushingEventListener 277 ) Could not synchronize database state with session
org.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch update
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:77)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:181)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
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 biz.intesy.tracker.domainfacade.user.EmployeeEducationModelFacade.insertEducation(EmployeeEducationModelFacade.java:116)
at biz.intesy.tracker.servlet.sms.EducationServlet.doPost(EducationServlet.java:52)
...
Caused by: java.sql.BatchUpdateException: Lock wait timeout exceeded; try restarting transaction
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:828)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:174)
... 33 more
Name and version of the database you are using:
Mysql 4.1.14
The generated SQL (show_sql=true):
insert into employee_education (education_start, education_end, institution, city, country_id, employee_id, employee_education_id) values (?, ?, ?, ?, ?, ?, ?)

Why?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 13, 2005 11:40 am 
Beginner
Beginner

Joined: Thu Jan 06, 2005 6:11 am
Posts: 32
Location: Magdeburg, Germany
From FAQ:

Quote:
My JDBC driver supports batch updates. How come Hibernate doesn't enable them by default?

Batch updates seem to be cause problems for some JDBC drivers that claim to support them. We found that batch updates should be disabled for DB2 and Sybase.


Maybe your driver is one of the problematic ones? I'm no expert though...[/quote]


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

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.