1 Reply Latest reply on May 4, 2006 11:45 AM by Gavin King

    SeamExtendedManagedPersistence: when does a commit occur?

    Carsten Hoehne Master

      Hello,
      i do need to understand SeamExtendedManagedPersistence a little better. hope you can help me.
      The stacktrace below is correct, when the commit of the transaction is correct. But why does the commit occur?

      Here a plot of my situation:
      A new object should be assembled in a long running conversation.
      - start conversation
      . assign objects from database
      - edit further properties
      - save object and end conversation.

      The stacktrace occurs when i execute this code (setting a bidirectional association):

       getProtocol().addMarker(primer);
       primer.setProtocol(getProtocol());
      

      where protocol is the Object to create (not persistent) and primer is a persistent object fetched from database in the current long running conversation.

      It is true, that protocol.name is not set since this and other properties will be filled in by the user.
      My question: I like to understand why the commit occurs.
      IMHO, a commit should only occur when my conversation ends.
      Is there something that i can do to prevent the commit?
      I am running hibernate in the jboss microcontainer on tomcat.
      Ciao,
      Carsten Hoehne
      15:06:47,343 DEBUG org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener: committing transaction
      15:06:47,343 DEBUG org.jboss.seam.util.Naming: JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
      15:06:47,421 ERROR org.jboss.seam.servlet.SeamExceptionFilter: uncaught exception handled by Seam
      javax.servlet.ServletException: Could not commit transaction
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:123)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:23)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:129)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       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:667)
       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(Thread.java:595)
      15:06:47,421 DEBUG org.jboss.seam.util.Naming: JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
      15:06:47,421 DEBUG org.jboss.seam.contexts.Lifecycle: After request, destroying contexts
      15:06:47,421 DEBUG org.jboss.seam.contexts.Lifecycle: destroying event context
      15:06:47,421 DEBUG org.jboss.seam.contexts.Contexts: destroying: pcrProtocolDAO
      15:06:47,421 DEBUG org.jboss.seam.contexts.Contexts: destroying: org.jboss.seam.core.manager
      15:06:47,421 DEBUG org.jboss.seam.contexts.Contexts: destroying: chemDAO
      15:06:47,421 DEBUG org.jboss.seam.contexts.Contexts: destroying: primer
      15:06:47,421 DEBUG org.jboss.seam.contexts.Contexts: destroying: primerDAO
      15:06:47,421 DEBUG org.jboss.seam.contexts.Contexts: destroying: pcrProgramDAO
      15:06:47,421 DEBUG org.jboss.seam.contexts.Lifecycle: flushing server-side conversation context
      15:06:47,421 DEBUG org.jboss.seam.contexts.Lifecycle: <<< End web request
      15:06:47,421 ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/baz].[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
      15:06:47,437 DEBUG org.jboss.util.NestedThrowable: org.jboss.util.NestedThrowable.parentTraceEnabled=true
      15:06:47,453 DEBUG org.jboss.util.NestedThrowable: org.jboss.util.NestedThrowable.nestedTraceEnabled=false
      15:06:47,453 DEBUG org.jboss.util.NestedThrowable: org.jboss.util.NestedThrowable.detectDuplicateNesting=true
      java.lang.IllegalStateException: Could not commit transaction
       at org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener.commit(SeamExtendedManagedPersistencePhaseListener.java:91)
       at org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener.afterPhase(SeamExtendedManagedPersistencePhaseListener.java:50)
       at org.apache.myfaces.lifecycle.LifecycleImpl.informPhaseListenersAfter(LifecycleImpl.java:567)
       at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:337)
       at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:108)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:23)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:129)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       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:667)
       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(Thread.java:595)
      Caused by: org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=null:1146747744515/17, BranchQual=null:1146747744515, localId=0:17], status=STATUS_NO_TRANSACTION; - nested throwable: (org.hibernate.PropertyValueException: not-null property references a null or transient value: de.bafz.lims.model.PCRProtocol.name)
       at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:1283)
       at org.jboss.tm.TxManager.commit(TxManager.java:587)
       at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:138)
       at org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener.commit(SeamExtendedManagedPersistencePhaseListener.java:85)
       ... 28 more
      Caused by: org.hibernate.PropertyValueException: not-null property references a null or transient value: de.bafz.lims.model.PCRProtocol.name
       at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
       at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:265)
       at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)
       at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
       at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:531)
       at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:523)
       at org.hibernate.engine.CascadingAction$1.cascade(CascadingAction.java:134)
       at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:213)
       at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:157)
       at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
       at org.hibernate.engine.Cascade.cascade(Cascade.java:248)
       at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:130)
       at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:121)
       at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1009)
       at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:356)
       at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:59)
       at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:3071)
       at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:2629)
       at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:1191)
       ... 31 more