2 Replies Latest reply on Jun 28, 2008 12:08 AM by Tomas Cerny

    Instantiation by Seam vs. Component.getInstance

    Tomas Cerny Novice

      I was solving a serialization problem I had in my application. This made me to think about one thing that I am not sure with.

      When Seam instantiate something for me implicitly then I have this:

      "Component.getInstance("teamActionManager",true);"=TeamActionManager  (id=24770)       

      Well I do not think this is a proxy:

      When I use Component.getInstance I have:

      "Component.getInstance(ReservationActionManager.class, true)"= Object_$$_javassist_32  (id=24817)       

      which is proxy.

      Well Seam documentation say that for beans (java, stateful, stateless) I should use proxy (to register the instance)

      But then I think that implicit instantiation is wrong?

      If I implement well the serialization in my beans should I care about it?


        • 1. Re: Instantiation by Seam vs. Component.getInstance
          Guillaume Jeudy Master

          Tomas, I think javassist proxies are serializable so as long as you implement serialization in your beans you should be fine. (Can be as simple as adding marker Serializable interface).

          How do you trigger implicit instantiation in your case?

          If your object is a seam managed component it should always be wrapped in a proxy. If it's not chances are that your object is not seam managed but is instantiated through the use of @Factory annotation for example.

          • 2. Re: Instantiation by Seam vs. Component.getInstance
            Tomas Cerny Novice

            Thank you for the answer

            How do you trigger implicit instantiation in your case?

            Well I do not know if I am using the right term here. Lets say that I start from a table in my JSF


            public class PersonList extends GeneralSearch<Person> {

            and then I pick a record in a table

            <s:link id="selectPerson" value="ajax" action="#{personAccountManager.select}">
                                               <f:param value="#{person.id}" name="personHome"/>

            and this calls my stateful bean, and instantiates it (well it is actually instantiated on the table page):

            public class PersonManager extends GeneralManager<Person> implements IPersonManager, IGeneralManager { 
            @Begin(flushMode = FlushModeType.MANUAL, join = true, pageflow = "personHomeFlow")
                public String select() {

            I do not have any @Factory for this. I guess it is like in JSF, that page requests a bean and it will get instantiated. So annotation stateful should do the seam work.

            Is that right?