6 Replies Latest reply on Jul 19, 2010 9:37 PM by meshe

    Richfaces 3.3.0 troubles hibernate?

    meshe

      Hi,

       

      I been having some issues when I migrate from the the richfaces version that seam 2.0.0GA has, to richfaces 3.3.0. I had some old code that now seems to start affecting hibernate with some native queries, any idea?

        • 1. Re: Richfaces 3.3.0 troubles hibernate?
          nbelaevski

          Hi Guillermo,

           

          Please post some more details of the problem: what code is used, expected and actual outputs.

          • 2. Re: Richfaces 3.3.0 troubles hibernate?
            meshe

            And this is the code, this code hasn't been changed at all, but the error started to present after I migrate the richfaces to 3.3.0.

             

            if (compute.getScenario().getWhatif())
            {
            compute.getScenario().setDataEnd(compute.getScenario().getBaseline().getScenario().getDataEnd());
            compute.getScenario().setDataEndP(compute.getScenario().getBaseline().getScenario().getDataEndP());
            int qstaus=entityManager.createNativeQuery("create table allattr_"+compute.getScenario().getName()+" as select a.* , b.risk from allattr a, churn_risk b where a.account_oid = b.account_oid and b.compute_oid = '"+
            compute.getScenario().getBaseline().getUuid()+"'").executeUpdate();
            for (Action action : compute.getScenario().getActions()){
            //convert date
            String auxDate="";
            if (action.getNextActionDate().before(compute.getScenario().getBaseline().getScenario().getDataEnd()))
            {
            auxDate=SqlConflictSolver.sqlDate(compute.getScenario().getBaseline().getScenario().getDataEnd()).toString();
            }
            else if (action.getNextActionDate().after(compute.getScenario().getBaseline().getScenario().getDataEndP()))
            {
            auxDate=SqlConflictSolver.sqlDate(compute.getScenario().getBaseline().getScenario().getDataEndP()).toString();
            }
            else
            {
            Date tempDate= new Date(action.getNextActionDate().getYear(),action.getNextActionDate().getMonth(),compute.getScenario().getBaseline().getScenario().getDataEnd().getDate());
            auxDate=SqlConflictSolver.sqlDate(tempDate).toString();
            }
            double perc = Double.parseDouble(""+action.getPercentage())/100.00;
            String segmentQuery="";
            if (action.getSegment() != null)
            segmentQuery+="and "+action.getSegment().getQuery();
            qstaus=entityManager.createNativeQuery("update allattr_"+compute.getScenario().getName()+
            " b set evt_recency = evt_recency -(select evt_recency from allattr where account_oid =b.account_oid and from_date = "+auxDate+
            " ), evt_freq = evt_freq+1 where from_date > "+auxDate+
            " and random_value <= "+perc+" "+segmentQuery).executeUpdate();
            if (action.getNextActionType().compareTo("UPL")==0){
            qstaus=entityManager.createNativeQuery("update allattr_"+compute.getScenario().getName()+
            " b set action_state='UPL', upl_recency = upl_recency-(select upl_recency from allattr where account_oid =b.account_oid and from_date = "+auxDate+
            " ), upl_freq = upl_freq+1, CUMNUM_IMAGES = CUMNUM_IMAGES + "+action.getImgUpl()+
            " where from_date >= "+auxDate+
            " and random_value <= "+perc+" "+segmentQuery).executeUpdate();
            }
            else if (action.getNextActionType().compareTo("ORD")==0){
            qstaus=entityManager.createNativeQuery("update allattr_"+compute.getScenario().getName()+
            " b set action_state='ORD', ord_recency = ord_recency-(select ord_recency from allattr where account_oid =b.account_oid and from_date = "+auxDate+
            " ), ord_freq = ord_freq+1, CUMAMT_ORDALL = CUMAMT_ORDALL + "+action.getTotalAmount()+
            " where from_date >= "+auxDate+
            " and random_value <= "+perc+" "+segmentQuery).executeUpdate();
            }
            else if (action.getNextActionType().compareTo("SHR")==0){
            qstaus=entityManager.createNativeQuery("update allattr_"+compute.getScenario().getName()+
            " b set action_state='SHR', shr_recency = shr_recency-(select shr_recency from allattr where account_oid =b.account_oid and from_date = "+auxDate+
            " ), shr_freq = shr_freq+1 where from_date >= "+auxDate+
            " and random_value <= "+perc+" "+segmentQuery).executeUpdate();
            }
            else if (action.getNextActionType().compareTo("CSR")==0){
            qstaus=entityManager.createNativeQuery("update allattr_"+compute.getScenario().getName()+
            " b set action_state='CSR', csr_recency = csr_recency-(select csr_recency from allattr where account_oid =b.account_oid and from_date = "+auxDate+
            " ), csr_freq = csr_freq+1 where from_date >= "+auxDate+
            " and random_value <= "+perc+" "+segmentQuery).executeUpdate();
            }
            }
            try{
            Process p;
            p = Runtime.getRuntime().exec("R CMD BATCH --no-restore --no-save --args --compute="+compute.getUuid()+" --extra=Ropts --table=allattr_"+compute.getScenario().getName()+" score.R");
            }
            catch (IOException e) {
            //  e.printStackTrace();
            }
            }

             

             

             

             

            The error displayed:

             

            Exception during request processing:

            Caused by javax.servlet.ServletException with message: "#{scenarioManager.saveScenario}: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute native bulk manipulation query"
            javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
            com.aurora.util.SaveAsFilter.doFilter(SaveAsFilter.java:70)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            com.aurora.util.RendererFilter.doFilter(RendererFilter.java:109)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
            org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
            org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
            org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
            org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
            org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
            org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
            org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
            org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
            org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
            org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
            org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
            org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
            org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
            org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
            java.lang.Thread.run(Thread.java:595)
            • 3. Re: Richfaces 3.3.0 troubles hibernate?
              nbelaevski

              Any more details to help you with the problem? I need to know the cause, otherwise I can't help much. So, couple of suggestions:

               

              1. Compare process execution arguments for different RF versions

              2. Check how many times is action method invoked simultaneously.

               

              Also what exactly is breaking in query?

              • 4. Re: Richfaces 3.3.0 troubles hibernate?
                meshe
                1. Compare process execution arguments for different RF versions

                 

                I dont get what you mean by process execution argumetns.

                 

                 

                2. Check how many times is action method invoked simultaneously.

                 

                This action can be invoked simultaneously by different users, but atm we are just trying with a single user.

                 

                 

                Also what exactly is breaking in query?

                 

                That's another thing, I havent figure which one is the one breaking.

                 

                 

                And mention before it's odd that the query is breaking when the only change is the RF version.

                • 5. Re: Richfaces 3.3.0 troubles hibernate?
                  nbelaevski

                  Guillermo Narvaez wrote:

                   

                  1. Compare process execution arguments for different RF versions

                   

                  I dont get what you mean by process execution argumetns.

                  I meant this line:

                   

                   

                  Process p;
                  p = Runtime.getRuntime().exec("R CMD BATCH --no-restore --no-save --args --compute="+compute.getUuid()+" --extra=Ropts --table=allattr_"+compute.getScenario().getName()+" score.R");

                  Also what exactly is breaking in query?

                   

                  That's another thing, I havent figure which one is the one breaking.

                  Ok, please find out and let me know.

                   

                  And mention before it's odd that the query is breaking when the only change is the RF version.

                  Seam 2.0.0.GA comes with RF 3.1.2, and you are using 3.3.0. Have you checked migration guide: http://docs.jboss.org/richfaces/latest_3_3_X/en/migrationguide/html/ ? Why do you use 3.3.0 and not the latest 3.3.3.Final? Also just to clarify: are you sure change in RF version is the only thing that have been changed?

                  • 6. Re: Richfaces 3.3.0 troubles hibernate?
                    meshe

                    For question 1:

                     

                    That command line works perfectly, we have that tested.

                     

                    For the query ill have to play around with it to find out which one is breaking.

                     

                    As for the migration, it is 3.3.3, I just looked into the files I downloaded. And yes I'm perfectly positive the only change in that code is the upgrade on RF version, since we had a stable version before I started doing the migration on the RF version.