0 Replies Latest reply on Apr 7, 2005 3:00 PM by Lukasz C

    Isolation level: serializable

    Lukasz C Newbie

      Hello,

      I write simple webapp. I want be sure that my transaction will be 'serializable' so I can change isolation level in database source (to serializable) or use hibernate annotation.

      Both when I use isolation level in database source and hibernate annotation I get exception like this:

      20:34:13,665 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
      org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
       at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82)
       at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
       at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
       at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:179)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
       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:675)
       at org.jboss.ejb3.entity.HibernateSessionFactory$SessionSynchronization.beforeCompletion(HibernateSessionFactory.java:84)
       at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1406)
       at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1099)
       at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:309)
       at org.jboss.aspects.tx.TxSupport.endTransaction(TxSupport.java:215)
       at org.jboss.aspects.tx.TxSupport.invokeInOurTx(TxSupport.java:153)
       at org.jboss.aspects.tx.TxSupport$Required.serverInvoke(TxSupport.java:438)
       at org.jboss.aspects.tx.TxInterceptor.internalInvoke(TxInterceptor.java:112)
       at org.jboss.aspects.tx.TxInterceptor.invoke(TxInterceptor.java:60)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:72)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:36)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:80)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:90)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:165)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:107)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:74)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:328)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:204)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:259)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:327)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:147)
      Caused by: Batch entry 0 update TestBean set name= was aborted. Call getNextException() to see the cause.
       at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:107)
       at org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:701)
       at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
       at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:172)
      20:34:13,670 INFO [STDOUT] javax.transaction.TransactionRolledbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=1112898265535flower/337, BranchQual=, localId=337] status=STATUS_NO_TRANSACTION; - nested throwable: (org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update)
      20:34:13,673 INFO [STDOUT] at org.jboss.aspects.tx.TxSupport.endTransaction(TxSupport.java:220)
      20:34:13,673 INFO [STDOUT] at org.jboss.aspects.tx.TxSupport.invokeInOurTx(TxSupport.java:153)
      ...
      ...
      


      I use PostgreSQL 7.4, and Postgres generate error when isolation of transaction will be broken by other transaction (postgres docs
      http://www.postgresql.org/docs/7.4/interactive/transaction-iso.html#XACT-SERIALIZABLE)
      So it is expected behaviour :)
      But ... how can I catch this exception on the server side ( in session bean for example ) ?

      Greetings
      Flower