Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.2
Mapping documents:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.jiyobindaas.model.UserPhoneNumbers" table="jb_user_phonenumbers" >
<id name="id" type="java.lang.Integer">
<column name="id" />
<generator class="native" />
</id>
<property name="userID" type="java.lang.String">
<column name="userID" length="50" />
</property>
<property name="make" type="java.lang.String">
<column name="phonemake" length="50" />
</property>
<property name="model" type="java.lang.String">
<column name="phonemodel" length="50" />
</property>
<property name="containerPhoneNumber" type="java.lang.String">
<column name="containerphonenumber" length="50" />
</property>
<property name="status" type="java.lang.String">
<column name="status"/>
</property>
<property name="country" type="java.lang.String">
<column name="country" length="50" />
</property>
<property name="network" type="java.lang.String">
<column name="network" length="50" />
</property>
<property name="active" type="java.lang.String">
<column name="active" length="50" />
</property>
<property name="lastHeartBeatDateTime" type="java.util.Date">
<column name="lastHeartBeatDateTime" length="50" />
</property>
<property name="IMEI" type="java.lang.String">
<column name="IMEI" length="50" />
</property>
<property name="verificationCode" type="java.lang.String">
<column name="verificationCode" length="50" />
</property>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
session = HibernateSessionFactory.getSession();
tx = session.beginTransaction();
try
{
getUserPhoneNumbers = session.createQuery(StringTable.SELECT_QUERY_FROM_USER_PHONENUMBERS_BY_USERID);
getUserPhoneNumbers.setString(StringTable.USERID_NAMED_PARAM,userID);
}
catch (HibernateException e) {
session.close();
return false;
}
results = getUserPhoneNumbers.list();
if (!results.isEmpty())
{
userPhoneNumbers = (UserPhoneNumbers) results.get(0);
}
else
{
userPhoneNumbers = new UserPhoneNumbers();
}
userPhoneNumbers.setCountry(country);
userPhoneNumbers.setContainerPhoneNumber(phoneNumber);
userPhoneNumbers.setUserID(userID);
query = session.createQuery(StringTable.SELECT_QUERY_FROM_USERIDS_BY_USERID);
query.setString(StringTable.USERID_NAMED_PARAM, userID);
results = query.list();
if(results.isEmpty())
{
userids = new Userids();
}
else
{
userids = (Userids) results.get(0);
}
if (!supported)
{
userPhoneNumbers.setStatus("V");
//userPhoneNumbers.setHasUnSupportedPhone(true);
setRegistrationStep(userID, 5);
userids.setSms_remaining(50);
userids.setRegistrationStep(5);
}
else
{
userPhoneNumbers.setVerificationCode(code);
userPhoneNumbers.setStatus("O");
log.info("UPDATING registrationStep to USERIDS");
userids.setRegistrationStep(step);
}
session.saveOrUpdate(userids);
session.saveOrUpdate(userPhoneNumbers);
tx.commit();
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:253)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at com.jiyobindaas.gwt.rpc.server.UserRegistrationServiceImpl.setMakeAndModel(UserRegistrationServiceImpl.java:1132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:164)
at com.jiyobindaas.gwt.rpc.server.UserRegistrationServiceImpl.processCall(UserRegistrationServiceImpl.java:692)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.BatchUpdateException: Lock wait timeout exceeded; try restarting transaction
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1666)
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1082)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
... 30 more
[7506250][Registration| User:test52 |+919701230927
|test52@yahoo.c] [2008-10-09 14:57:49,250] [DEBUG] [http-8090-Processor14] [com.jiyobindaas.gwt.rpc.server.UserRegistrationServiceImpl.onBeforeRequestDeserialized] - ML onBeforeRequestDeserialized in Registration
[7509718][Registration| User:test52 |+919701230927
|test52@yahoo.c] [2008-10-09 14:57:52,718] [FATAL] [http-8090-Processor19] [com.jiyobindaas.utils.JBUtils.logStackTrace] - Unexpected Failure(GWT).
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract boolean com.jiyobindaas.gwt.rpc.client.UserRegistrationService.setMakeAndModel(java.lang.String,java.lang.String,java.lang.String,int)' threw an unexpected exception: org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:360)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:546)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:164)
at com.jiyobindaas.gwt.rpc.server.UserRegistrationServiceImpl.processCall(UserRegistrationServiceImpl.java:692)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
Caused by: 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:253)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at com.jiyobindaas.gwt.rpc.server.UserRegistrationServiceImpl.setMakeAndModel(UserRegistrationServiceImpl.java:1132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
... 19 more
Caused by: java.sql.BatchUpdateException: Lock wait timeout exceeded; try restarting transaction
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1666)
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1082)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
... 30 more
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html