2 Replies Latest reply on Jun 9, 2011 6:12 AM by Rob Shepherd

    Outject component instace in java code

    Alexei R Newbie

      Hello, can I outject some component o other object instance by using the seam api, Some like this


      but outjecting


        • 1. Re: Outject component instace in java code
          omid pourhadi Apprentice

          I don't know what your need exactly is but for outjecting a component usually use @Out annotation and
          sometimes i use @Unwrap annotation to load a specific entity

          public class Service {
             EntityManager em;   
             public YourEntity getYourEntity(){
                return em.createQuery().getSingleResult();

          Use in other Bean

          YourEntity yourentity

          • 2. Re: Outject component instace in java code
            Rob Shepherd Newbie

            For the Session scope you can do the following:

            String myContextVarName = "myContextVarName";
            Object mySessionObject = new Object();
            if(  Contexts.isSessionContextActive() )
                Contexts.getSessionContext().set(myContextVarName, mySessionObject);
                // oops no session yet.