facebook

Record saves but exception is thrown

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #223938 Reply

    rudidoku
    Member

    Hi,

    I’m new to hibernate. I’ve been following a tutorial on the hibernate website. My problem is that an exception is thrown when i try to insert a new record. I have noticed that the exception is thrown on execution of the commit method of the transaction object. The INTERESTING thing that I have noted is tha the record is always saved to the database (MySQL) even when the exception is thrown. here is the stack trace :

    ! inside CREATE!!!
    ! about to save
    about to commit
    net.sf.hibernate.HibernateException: identifier of an instance of com.rdoku.model.User altered from 3 to 3
    at net.sf.hibernate.impl.SessionImpl.checkId(SessionImpl.java:2662)
    at net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2485)
    at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2478)
    at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2280)
    at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2259)
    at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
    at com.rdoku.dao.hibernatedao.UserHibernateDAO.create(UserHibernateDAO.java:60)
    at com.rdoku.action.RegisterAction.execute(RegisterAction.java:93)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    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:237)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
    at java.lang.Thread.run(Thread.java:534)

    any tips would be very much appreciated.

    #223943 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev, this is not ME related.

    Also, try and turn on show_sql=true in your hibernate properties or XMl file so hibernate showsyou the SQL statements it is execution. I would also suggest searching the hibernate forums for more accurate help (I’m not sure what is going on off the top of my head, it seems very strange).

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Record saves but exception is thrown

You must be logged in to post in the forum log in