6 Replies Latest reply on Oct 20, 2011 9:34 AM by christophe.carvalho

    Updates don't work after 10 minutes

    christophe.carvalho

      Hi,


      In my seam application (2.2.0 GA) i discovered the following issue :


      If i wait more than 10 minutes on a view, then when i call entiyHome.update() to update en entity no updates are persists to the database and there is no error in the log :(...


      I have increase session and conversation timeout to 30 minutes.


      Regards.

        • 1. Re: Updates don't work after 10 minutes
          mana.hotmana76.gmail.com

          You should notice in log if session or conversation timeout happens.

          • 2. Re: Updates don't work after 10 minutes
            christophe.carvalho

            Ok i'll try...


            I just unable the sql log and when i don't wait 10 minutes there are Hibernate: update in the log but if i wait more than 10 minutes no Hibernate: update :(...

            • 3. Re: Updates don't work after 10 minutes
              christophe.carvalho

              Passivation of ejb seems to be the cause of my problem...


              Only my ejb stateful session beans seem to be concerned. In log, after 6 minutes, there is the passivation of my ejb and then calling entityHome.update() in this bean doesn't work...


              Any ideas ?


              Regards.

              • 4. Re: Updates don't work after 10 minutes
                christophe.carvalho

                So, i add @Cache(org.jboss.ejb3.cache.NoPassivationCache.class) (which prevent passivation) to my SFSB and updates works correctly even after 10 minutes...


                But disabling passivation is not recommended i think... So what am i doing wrong ? Is it a configuration problem ?

                • 5. Re: Updates don't work after 10 minutes
                  mana.hotmana76.gmail.com

                  Could you show your code?

                  • 6. Re: Updates don't work after 10 minutes
                    christophe.carvalho

                    Sorry for the delay and thanks for your help...



                    Here is my SFSB code :



                    @Stateful
                    @Scope(ScopeType.CONVERSATION)
                    @Name("matriceLot")
                    //@Cache(org.jboss.ejb3.cache.NoPassivationCache.class)
                    public class MatriceLotBean implements MatriceLot {
                        ...
                    
                        @In(value="entityManager")
                        EntityManager em;    
                    
                        @Out(required = false)
                        private NumericCrossTable<LigneMatricePlanning, CDTColumn, Float> matriceLotCDT = null;
                    
                        List(Assignable) lignes;
                    
                        ...
                    
                        public void updateCrossDataTableValues() {     
                         if(matriceLotCDT != null){
                    
                            for(Line<LigneMatricePlanning, Float> line : matriceLotCDT.getLineList()){
                    
                                   Assignable assignableRef = (Assignable) line.getLineDesignation();
                                        
                                // TODO : to deal with passivation problem
                                Assignable assignable = null;
                                        
                                for (Assignable assignableTmp : lignes) {
                                   if (assignableTmp.equals(assignableRef)) {
                                    assignable = assignableTmp;
                                    break;
                                }
                                }
                    
                                  if ((assignable != null) && assignable.getId() > 0) {
                                   for (Column<CDTColumn> column : matriceLotCDT.getColumnList()){
                                        Cell<Float> cell = matriceLotCDT.getCell(line.getLineId(),column.getColumnId());
                    
                                           if(matriceLotRealisee){
                                             assignable.setChargeEffective(column.getColumnDesignation().getDate(),cell.getCellValue(), modeSaisieActivite);
                                           } else {
                                             assignable.setChargeInitiale(column.getColumnDesignation().getDate(),cell.getCellValue(), modeSaisieActivite);
                                           }
                                   }                              
                                  }
                             }
                    
                               ....
                    
                               em.flush();
                    
                         }
                         }
                    }




                    But it's clearly a passivation problem, i have enabled the ManagedEntityInterceptor (core:init distributable true) and it works if my entitys (the values assignable above) are direct properties of my SFSB.



                    My problem now is that my entitys are stored in an object (NumericCrossTable) and if i access my entitys directly from that object after passivation they are detached...That why i add the following bad workaround :




                    Assignable assignableRef = (Assignable) line.getLineDesignation();
                                        
                       // TODO : to deal with passivation problem
                       Assignable assignable = null;
                                        
                       for (Assignable assignableTmp : lignes) {
                         if (assignableTmp.equals(assignableRef)) {
                                 assignable = assignableTmp;
                              break;
                         }
                       }




                    For information, the class NumericCrossTable implements Serializable.


                    Is there a way to prevent my entitys from being detached even if they are not direct properties of my SFSB ?



                    Sorry for my bad english ;).


                    Regards.