3 Replies Latest reply on May 18, 2007 10:25 AM by m.shinde

    Calling merge/persist even not called....

    m.shinde

      hi
      I have manageOrders.xhtml file showing one list box of articles and my requirement is after selection of one article , my page should get populated with article information. So I have written code like

      xhtml code.....
      <h:selectOneMenu value="#{article}" id="articleId" rendered="true" immediate="true">
      <s:selectItems value="#{articles}" var="articleId"
      label="#{articleId.name}" noSelectionLabel="[Please Select...]" />
      <ec:convertEntity
      entityClass="de.bonprix.orderstarter.model.entity.Article" />
      </h:selectOneMenu>
      
      
      <h:commandButton value="Go" type="submit" action="#{manageOrders.callAction}"/>
      
      Java code.....
      
      @Stateful
      @Name("manageOrders")
      @Scope(ScopeType.CONVERSATION)
      @Interceptors(org.jboss.seam.ejb.SeamInterceptor.class)
      @Intercept(InterceptionType.ALWAYS)
      public class ManageOrders implements IManagerOrder {
      
       @In
       private EntityManager entityManager;
      
       @In(required = false,create=true)
       @Out(required = false)
       private Article article;
      
       public String callAction() {
       log.info("this.article.getArticleId() :" + this.article);
       this.article = (Article) entityityManager.createNamedQuery(
       "findArticleById").setParameter("id",
       this.article.getArticleId()).getSingleResult();
       return "/manageOrders.xhtml";
       }
      
      


      But while calling this callAction method I am getting following error....
      I am unable to understand I am not calling merge/persist method still it is calling for updation of article.

      Please suggest. Getting stuck.

      18:55:53,755 WARN [JDBCExceptionReporter] SQL Error: 1407, SQLState: 72000
      18:55:53,755 ERROR [JDBCExceptionReporter] ORA-01407: cannot update ("EXTRANET_MISC"."ORDERSTARTER_ART"."ART_NR") to NULL
      
      18:55:53,771 WARN [JDBCExceptionReporter] SQL Error: 1407, SQLState: 72000
      18:55:53,771 ERROR [JDBCExceptionReporter] ORA-01407: cannot update ("EXTRANET_MISC"."ORDERSTARTER_ART"."ART_NR") to NULL
      
      18:55:53,786 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:103)
       at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
       at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
       at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
       at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
       at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
       at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:515)
       at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:116)
       at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:241)
       at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:88)
       at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
       at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1204)
       at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
       at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
       at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:175)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:105)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:204)
       at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:100)
       at $Proxy675.callAction(Unknown Source)


        • 1. Re: Calling merge/persist even not called....
          stu2

          You might try knocking the batch size in your hibernate configuration down to zero to see what the actual problem is (I had to do this yesterday - see hibernate docs for howto). Hsqldb doesn't seem to give good errors for batch updates.

          But I think the default EJB3 SFSB behavior is to flush the EntityManager prior to the transaction committing. So if you had any dirty entities known to the EntityManager, those would be flushed automagically. It looks like this is what's happening to you - though I don't know of a way to identify what those are during flushing. Anyway, if you don't want this behavior, change the flush mode when you start the conversation, as per the seam docs.

          • 2. Re: Calling merge/persist even not called....

            Hello Mahesh!

            I cannot check at the moment but I guess that "EXTRANET_MISC"."ORDERSTARTER_ART"."ART_NR" has a "not null" constraint. (If it does not it should have :-))

            I suspect the error is not even related to your code since the code you have shown does not attempt to update the data. But it is possible that a query forces a flush of the entitymanager.

            Regards

            Felix

            • 3. Re: Calling merge/persist even not called....
              m.shinde

              Hi Felix,

              Thanx for reply.

              I already sent you mail about this. The problem is resolved by defining individual properties into the Stateless bean. like name,sai... those are Article information. And I used those in xhtml to Inject and Outject...
              It can be resolved if we can use different seam defined name for the Same entity. like as I said @Names(..)