1 Reply Latest reply on Aug 7, 2009 8:07 PM by Arbi Sookazian

    Page Redirect problem ConcurrentModificationException

    Piotr Salski Newbie

      Don't know what is happening :(


      I have entity event that persists when save button pressed and {eventAction.register} is called.


      @Stateless
      @Name("eventAction")
      public class eventAction implements Registerint
      {
           @In(create=true, required =false) event event;
           @PersistenceContext  
           private EntityManager em;
           
           public String register()
           {
                em.persist(event);
                      return "success";        
           }
      }



      but if I want to redirect it to another page it is working fine (entity will persist and page will be redirected to required page)


      I tried redirect 2 different ways


      1. By adding


      public String register()
           {
                em.persist(event);                        
                
                return "/eventAdded.xhtml";
           }



      2. or adding to page.xml



      <navigation from-action="#{eventAction.register}">
                        <rule if-outcome="success">
                             <redirect view-id="/eventAdded.xhtml"/>
                        </rule>
                   </navigation>



      I will get error:


      12:24:45,151 INFO  [STDOUT] Hibernate: 
          select
              hibernate_sequence.nextval 
          from
              dual
      12:24:45,189 INFO  [STDOUT] Hibernate: 
          insert 
          into
              event
              (children, city, couple, description, email, endDate, endTime, enterFee, eventname, groups, openspace, parking, phone, place, sidecity, single, startDate, startTime, street, zip, id) 
          values
              (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
      12:24:45,198 ERROR [SeamPhaseListener] uncaught exception
      java.util.ConcurrentModificationException
           at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
           at java.util.HashMap$EntryIterator.next(Unknown Source)
              ......
              ......



      Anybody know why I get this error when redirecting, If I remove redirect I will not get this error? Even thought with this error, redirecting and persisting works, but I don't want to leave it like this :)