this is my deletereg_code function . in that it cannot commit the transaction. Actually it works perfectly, but now it is not working. the code is:
public void deleteRegistrationMasterEntry(String reg_code) { Session hibernateSession = HibernateUtil.currentSession(); Transaction transaction = HibernateUtil.beginTransaction(); transaction.begin(); String szQuery = "from " + DBConstants.REGISTRATION_MASTER_TABLE + " where " + DBConstants.REGISTRATION_CODE + "=?"; RegistrationMaster oRegistrationMaster = (RegistrationMaster) hibernateSession.createQuery(szQuery).setString(0, reg_code).uniqueResult(); moLogger.debug("REgistration code recieved"+reg_code); if (oRegistrationMaster == null) { moLogger.debug("Null result after query"); } else { moLogger.debug("Query returned success"); } moLogger.debug("before delete reg.code"); hibernateSession.delete(oRegistrationMaster); moLogger.debug("after delete reg.code"); moLogger.debug("before commiting transaction"); HibernateUtil.commitTransaction(transaction); moLogger.debug("after completing transaction"); }
plz rely me asap
the Exception is
DEBUG 20-07-10 17:56:11,012 (processSMS,deleteRegistrationMasterEntry)[http-8080 -1]- Query : from RegistrationMaster where registrationCode=? DEBUG 20-07-10 17:56:11,028 (processSMS,deleteRegistrationMasterEntry)[http-8080 -1]- REgistration code recieved33414868748148 DEBUG 20-07-10 17:56:11,028 (processSMS,deleteRegistrationMasterEntry)[http-8080 -1]- Query returned success DEBUG 20-07-10 17:56:11,028 (processSMS,deleteRegistrationMasterEntry)[http-8080 -1]- before delete reg.code DEBUG 20-07-10 17:56:11,028 (processSMS,deleteRegistrationMasterEntry)[http-8080 -1]- after delete reg.code DEBUG 20-07-10 17:56:11,028 (processSMS,deleteRegistrationMasterEntry)[http-8080 -1]- before commiting transaction ERROR 20-07-10 17:56:11,059 (processSMS,RegistrationCheck)[http-8080-1]- Excepti on ossured while registration ....Rolling back all DB actions org.hibernate.exception.ConstraintViolationException: Could not execute JDBC bat ch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.j ava:71) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelp er.java:43) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java: 253) at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.j ava:92) at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.j ava:87) at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatc her.java:222) at org.hibernate.persister.entity.AbstractEntityPersister.insert(Abstrac tEntityPersister.java:2224) at org.hibernate.persister.entity.AbstractEntityPersister.insert(Abstrac tEntityPersister.java:2660) at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.ja va:56) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutio ns(AbstractFlushingEventListener.java:298) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlus hEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java :106) at com.ss.trap.business.utility.HibernateUtil.commitTransaction(Hibernat eUtil.java:96) at com.ss.trap.managers.UserManager.deleteRegistrationMasterEntry(UserMa nager.java:316) at com.ss.trap.managers.UserManager.RegistrationCheck(UserManager.java:9 8) at com.ss.trap.servlets.processSMS.registrationCommand(processSMS.java:5 15) at com.ss.trap.servlets.processSMS.processRequest(processSMS.java:217) at com.ss.trap.servlets.processSMS.doGet(processSMS.java:273) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV alve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV alve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j ava:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j ava:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal ve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav a:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java :845) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce ss(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44 7) at java.lang.Thread.run(Thread.java:619) Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into public.user_ details (first_name, last_name, address, state, city, country, postalpin, altern ate_number, alternate_number1, web_password, email, hotkey, pin, is_deleted, rol e_id, user_id) values (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NUL L, NULL, 12345, abcd, 0, NULL, 1) was aborted. Call getNextException to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handle Error(AbstractJdbc2Statement.java:2530) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutor Impl.java:1317) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.ja va:350) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc 2Statement.java:2592) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.jav a:48) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java: 246) ... 34 more
|