4 Replies Latest reply on Jun 23, 2006 8:42 AM by Urs Wagner

    identifier of an instance of ... was altered from 1 to 0

    Urs Wagner Novice

      What means this exception?
      java.lang.RuntimeException: org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=Ursus/34, BranchQual=, localId=34] status=STATUS_NO_TRANSACTION; - nested throwable: (org.hibernate.HibernateException: identifier of an instance of org.person.ejb.Login was altered from 1 to 0)



      type Exception report

      message

      description The server encountered an internal error () that prevented it from fulfilling this request.

      exception

      javax.servlet.ServletException: org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=Ursus/34, BranchQual=, localId=34] status=STATUS_NO_TRANSACTION; - nested throwable: (org.hibernate.HibernateException: identifier of an instance of org.person.ejb.Login was altered from 1 to 0)
      org.person.web.LoginActionServlet.doit(LoginActionServlet.java:92)
      org.person.web.LoginActionServlet.doPost(LoginActionServlet.java:55)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

      root cause

      java.lang.RuntimeException: org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=Ursus/34, BranchQual=, localId=34] status=STATUS_NO_TRANSACTION; - nested throwable: (org.hibernate.HibernateException: identifier of an instance of org.person.ejb.Login was altered from 1 to 0)
      org.jboss.aspects.tx.TxPolicy.handleEndTransactionException(TxPolicy.java:198)
      org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:180)
      org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
      org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:192)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:294)
      org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:55)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      org.jboss.ejb3.stateful.StatefulRemoteProxy.invoke(StatefulRemoteProxy.java:133)
      $Proxy462.login(Unknown Source)
      org.person.web.LoginActionServlet.doit(LoginActionServlet.java:83)
      org.person.web.LoginActionServlet.doPost(LoginActionServlet.java:55)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

      n


        • 1. Re: identifier of an instance of ... was altered from 1 to 0
          Urs Wagner Novice

          This is the source


          import java.io.Serializable;

          import java.util.List;

          import javax.ejb.Remote;
          import javax.ejb.Remove;
          import javax.ejb.Stateful;

          import javax.persistence.EntityManager;
          import javax.persistence.PersistenceContext;
          import javax.persistence.Query;

          @Stateful
          @Remote(Visitor.class)
          public class VisitorSessionBean implements Visitor, Serializable {

          @PersistenceContext
          private EntityManager manager;

          private Login login;

          public boolean login(String userName, String passWord) {

          String hql = "from Login l where l.userName = :userName and l.passWord = :passWord";
          Query query = manager.createQuery(hql);
          query.setParameter("userName", userName);
          query.setParameter("passWord", passWord);
          List list = query.getResultList();

          return list.size() == 1;
          }


          • 2. Re: identifier of an instance of ... was altered from 1 to 0
            Urs Wagner Novice

            Prepared Statement has two states why?


            2006-06-13 00:17:41,578 DEBUG [org.hibernate.hql.ast.QueryTranslatorImpl] HQL: from org.person.ejb.Login l where l.userName = :userName and l.passWord = :passWord
            2006-06-13 00:17:41,578 DEBUG [org.hibernate.hql.ast.QueryTranslatorImpl] SQL: select login0_.loginid as loginid12_, login0_.username as username12_, login0_.password as password12_ from login login0_ where login0_.username=? and login0_.password=?
            2006-06-13 00:17:41,578 DEBUG [org.hibernate.hql.ast.ErrorCounter] throwQueryException() : no errors
            2006-06-13 00:17:41,609 DEBUG [org.jboss.mx.loading.UnifiedClassLoader] New jmx UCL with url null
            2006-06-13 00:17:41,609 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3@1dbad5b, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader@fa0f67{ url=null ,addedOrder=0}
            2006-06-13 00:17:41,609 DEBUG [org.jboss.mx.loading.UnifiedClassLoader] New jmx UCL with url null
            2006-06-13 00:17:41,609 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3@1dbad5b, cl=org.jboss.mx.loading.UnifiedClassLoader3@10937cb{ url=null ,addedOrder=0}
            2006-06-13 00:17:41,625 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
            2006-06-13 00:17:41,625 DEBUG [org.hibernate.jdbc.ConnectionManager] opening JDBC connection
            2006-06-13 00:17:41,625 DEBUG [org.hibernate.SQL] select login0_.loginid as loginid12_, login0_.username as username12_, login0_.password as password12_ from login login0_ where login0_.username=? and login0_.password=?
            2006-06-13 00:17:41,640 DEBUG [org.hibernate.loader.hql.QueryLoader] bindNamedParameters() urswag -> userName [1]
            2006-06-13 00:17:41,640 DEBUG [org.hibernate.loader.hql.QueryLoader] bindNamedParameters() urs-1wag -> passWord [2]
            2006-06-13 00:17:41,640 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open ResultSet (open ResultSets: 0, globally: 0)
            2006-06-13 00:17:41,640 DEBUG [org.hibernate.loader.Loader] result row: EntityKey[org.person.ejb.Login#1]
            2006-06-13 00:17:41,656 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close ResultSet (open ResultSets: 1, globally: 1)
            2006-06-13 00:17:41,656 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
            2006-06-13 00:17:41,656 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
            2006-06-13 00:17:41,656 DEBUG [org.hibernate.jdbc.ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
            2006-06-13 00:17:41,656 DEBUG [org.hibernate.engine.TwoPhaseLoad] resolving associations for [org.person.ejb.Login#1]
            2006-06-13 00:17:41,671 DEBUG [org.hibernate.engine.TwoPhaseLoad] done materializing entity [org.person.ejb.Login#1]
            2006-06-13 00:17:41,671 DEBUG [org.hibernate.engine.StatefulPersistenceContext] initializing non-lazy collections
            2006-06-13 00:17:41,671 DEBUG [org.jboss.mx.loading.UnifiedClassLoader] New jmx UCL with url null
            2006-06-13 00:17:41,671 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3@1dbad5b, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader@c12bfd{ url=null ,addedOrder=0}
            2006-06-13 00:17:41,671 DEBUG [org.jboss.mx.loading.UnifiedClassLoader] New jmx UCL with url null
            2006-06-13 00:17:41,671 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3@1dbad5b, cl=org.jboss.mx.loading.UnifiedClassLoader3@2ef8a9{ url=null ,addedOrder=0}
            2006-06-13 00:17:41,671 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] processing flush-time cascades
            2006-06-13 00:17:41,671 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] dirty checking collections
            2006-06-13 00:17:41,687 DEBUG [org.jboss.ejb3.entity.ManagedEntityManagerFactory] ************** closing entity managersession **************
            2006-06-13 00:17:41,687 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/bank3].[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception


            • 3. Re: identifier of an instance of ... was altered from 1 to 0
              Evan Nail Newbie

              Any resolution on this. I'm getting this on a bean also..it used towork before I started playing with some things and now I cant figure out what I've done wrong.

              • 4. Re: identifier of an instance of ... was altered from 1 to 0
                Urs Wagner Novice

                I do not exactly know what the problem is. I have changed the bean name to Vistit and the table to visit, this does work.
                When MySQL generates an error You get such a kind of error because the transcation is roll backed.
                Perhaps MySQL does not return an exact error message like in error cases. Or Hibernate suppress the MySQL error. ....