3 Replies Latest reply on Dec 27, 2013 9:24 AM by Wolf-Dieter Fink

    problem inject cdi

    Alessio Varalta Newbie

      Hello, I have a problem in the use of the @ Inject in a project that uses cdi-jpa + .Il problem and inject that is invoked only the first time I call a certain class that is session_scope and then not called. How do I get to be called ongi time you call the class

        • 1. Re: problem inject cdi
          Wolf-Dieter Fink Master

          Hello Alessio,

           

          you should provide a bit more details to get help. How your code look like and what is your expactation?

          • 2. Re: problem inject cdi
            Alessio Varalta Newbie

            private Parametro parametri;

              @Inject

               public void setService(Parametro parametri) {

                 this.parametri =parametri;

                 System.out.println("Controllo parametri recuperato");

             

             

              

              

                 this.id_persona=parametri.getIndicePersona();

                    this.parametro_attivo=parametri.getParametro_attuale();

              

                

                

               }

             

            My problem is that this function is invoked automatically, only the first time that I request the class .. As a result of no longer being invoked and is a problem because I could go back to the previous page, change the parameters and return to my page. . Would that this function was invoked every time you require the class

            • 3. Re: problem inject cdi
              Wolf-Dieter Fink Master

              I suppose that is more a design question. As I understand the issue you should not use the parameter for injection or you need to have a different scope for your Bean.