3 Replies Latest reply on Jun 26, 2007 5:47 AM by pmuir

    Question: Why would a seam component be injected in some cla

    charlesnaude

      Question: Why would a seam component be injected in some classes and not others.

      Is there something that I'm missing?

      what should I look for that might be the problem


      please help!!!!!!!!!!!

      any help would be greatly appreciated.

        • 1. Re: Question: Why would a seam component be injected in some
          delphi'sghost

          Depends on a few things, posting some code might help.

          What are the create and required attributes on the @In annotation set to?

          If Seam cannot create a component because of an error somewhere in the creation process, that might be a source of the problem, but it should raise an exception somewhere down the line.

          • 2. Re: Question: Why would a seam component be injected in some
            charlesnaude

            Hi thanks for replying

            I think (hope) I solved the problem.

            here is some of my code..

            @Name("hocasService")
            public class HocasService {
            
             @In
             private Session agriCardDatabase;
            
             public Element submitRequest(AnyElement request,Session agriCardDatabasess){
            
             AgriSetup setup = (AgriSetup)agriCardDatabase.createQuery("select s from AgriSetup s where s.currentEnvironment = :current ")
             .setBoolean("current",true)
             .uniqueResult();
            


            I was instantiating the HocasService like a normal java class instead of letting seam do this for me.

            this seamed to do the trick :
             @In(required=false,create=true)
             private HocasService hocasService;
            
            private void doSomeStuff(){
             hocasService.submitRequest(xml);
            }
            



            please tell me if this could have been the problem or if I'm on the wrong track.





            • 3. Re: Question: Why would a seam component be injected in some
              pmuir

              Yes. Seam doesn't intercept objects instantiated using the new keyword.